Skip to main content

Overview

The Narrative MCP server exposes platform operations as tools that AI assistants can discover and call. All tool names use the narrative_ prefix. This page documents every available tool, its parameters, and usage patterns. For setup instructions, see Connecting to the Narrative MCP Server. For background on how the server works, see MCP Server for Agents.

Server URL

Context tools

Context tools manage your authenticated session and company scope.

narrative_context_get

Returns the current session context: authenticated user, role, and active company (if one has been set). Use this to confirm which company is active before running queries or operations. If no company is set, follow up with narrative_context_set_company.

narrative_context_get_companies

Lists the companies the authenticated user belongs to. Returns each company’s id and name. Use this to discover which companies you can switch to.

narrative_context_set_company

Switches the active company for the current session. All subsequent tool calls operate against the selected company until changed.

narrative_context_search_companies

Searches companies by name using case-insensitive substring matching. Available to global administrators only. Returns { id, name } for each matching company.

Dataset tools

Dataset tools let you search, describe, and inspect datasets. Finds datasets by fuzzy keyword match, tags, or data plane. At least one filter must be supplied — calling with no filters returns an error rather than the full corpus. Filters compose with AND. Returns at most 50 ranked matches. If the response indicates more matches exist, narrow the filters and retry. For full metadata on a shortlisted dataset, call narrative_datasets_describe with its id.

narrative_datasets_describe

Describes one or more datasets with configurable detail levels. Accepts multiple dataset ids in a single call and fetches them in parallel. Available include values:

narrative_dataset_get_column_stats

Returns per-column statistics for a single dataset. Available include values:

narrative_dataset_set_column_stats_config

Configures which columns have statistics collected on a dataset.

Dataset operation tools

These tools trigger asynchronous operations on datasets. All return a job or operation id that you can poll for completion.

narrative_dataset_request_sample

Enqueues a sampling job for a dataset. Returns the job id. Poll completion with narrative_jobs_describe.

narrative_dataset_refresh_materialized_view

Triggers a refresh of a materialized-view dataset. Returns the refresh job id. Poll completion with narrative_jobs_describe.

narrative_dataset_recalculate_statistics

Enqueues a column-statistics recalculation across the dataset’s snapshot range. Returns the recalculation id, queued snapshot count, and snapshot timestamp range.

narrative_dataset_update

Updates the safe, curator-editable metadata of a dataset: display name, description, and tags. Wraps PUT /datasets/:id. Structural fields (name, schema, write mode) are never editable through this tool. At least one of display_name, description, add_tags, or remove_tags must be provided. Omitted fields are left unchanged (partial update). Tags are edited additively: the tool reads the dataset’s current tags, applies add_tags and remove_tags, then writes the resulting set. A small set of platform-managed system tags — _nio_view, _nio_inference, _nio_cached_mapping, _nio_materialized_view, and _nio_refresh_use_workflow — are immutable and silently ignored if included in add_tags or remove_tags; any other tag (including custom _nio* tags) is caller-controlled. pending datasets accept updates to all safe fields; active datasets accept display name, description, and tags; archived datasets reject any update.
The upstream endpoint currently treats an empty tag list as a no-op, so a remove_tags that would clear the dataset’s last remaining tag is rejected with a clear error rather than silently ignored.
Returns a confirmation with the updated display name, description, and tags.

Attribute tools

Attribute tools let you explore, inspect, and create Rosetta Stone attributes. Searches Rosetta Stone attributes by name. Available include values:

narrative_attributes_describe

Describes one or more attributes by id. Accepts multiple attribute ids in a single call. Uses the same include values as narrative_attributes_search.

narrative_attribute_create

Creates a new attribute owned by the currently selected company. Wraps POST /attributes. The type_definition argument accepts one of these shapes:
  • Scalar types{ "type": "string" | "long" | "double" | "boolean" | "timestamptz" }. string and long accept an optional enum of allowed values. All scalars accept optional validations: Spark SQL boolean expressions over $this that a value must satisfy (e.g. "$this >= 0").
  • Object types{ "type": "object", "properties": { <name>: <type definition>, ... }, "required": [ <name>, ... ] }. Nest additional type definitions inside properties.
  • Array types{ "type": "array", "items": <type definition> }.
Attributes are created private to the owning company (no view/map collaborators); sharing is managed through the Narrative app or API. The created attribute’s id, name, display name, type, description, tags, owning company, and schema details are returned in the response.
Search the catalog with narrative_attributes_search before creating a new attribute — mapping into an existing attribute keeps the marketplace’s shared vocabulary consistent. A good reason to create a new attribute is to define the type contract for a downstream system (usually reached through a connector) that data is normalized into.
See attribute types for the full type reference.

Access rule tools

Access rule tools let you discover and inspect access rules — the permissions and pricing controls applied to datasets — that your company owns or has been granted. Searches access rules the active company has access to. At least one filter must be provided; calling with no filters returns an error rather than dumping the full corpus. Filters compose with AND. Matches are ranked by fuzzy score with name-side fields weighted above description and company fields, and truncated with an explicit note when the cap fires; refine the filters if you see the truncation message. Available include values: To reference a rule in NQL, use <owning_company_slug>.<access_rule_name>.

narrative_access_rules_describe

Describes one or more access rules by id. Accepts multiple ids in a single call and fetches them in parallel. Available include values:

Mapping tools

Mapping tools let you create Rosetta Stone mappings from datasets to attributes in the active company.

narrative_mapping_create

Creates a private mapping from a dataset to an attribute in the currently selected company. The mapping defines how each of the attribute’s properties is built from a row of the source dataset, using NQL expressions over the dataset’s columns. The mapping argument accepts one of three shapes:
  • object_mapping — for attributes whose value is an object. Supply type: "object_mapping" and property_mappings, a list of { path, expression } entries where path is a dotted path to an attribute property (e.g. product.brand) and expression is an NQL expression over dataset columns (e.g. itemBrand). Provide a mapping for each of the attribute’s required properties. Quote string literals like 'SKU'.
  • value_mapping — for scalar attributes. Supply type: "value_mapping" and a single expression that produces the attribute’s value.
  • cached_mapping — compiles into a dataset join at query time. Supply type: "cached_mapping" and one or more input_expressions — NQL expressions over the source dataset’s columns that form the join key. The cache dataset is created automatically when the mapping is created, so no cache_dataset_id is supplied. Not permitted on opt-out attributes (data_privacy_request_identifier, unique_id, identifier_relation). See cached_mapping for details.
The dataset must be active and owned by the current company, and you must have map permission on the attribute. The created mapping’s id, scope, source, status, and creation timestamp are returned in the response.
Use narrative_nql_validate to test a candidate mapping expression before submitting it. Run SELECT <expression> FROM company_data."<dataset_id>" — if it compiles, the expression is valid against the dataset’s schema.
See mapping types for the full schema and Mapping schemas for guidance on writing mappings by hand.

Connector tools

Connector tools let you inspect a company’s installed apps and create connections that route dataset data to external connectors. See the connection creation flow below for the recommended order.

narrative_installations_list

Lists the apps installed by the currently selected company and flags which ones are connectors. Apps whose categories include destination_connector can receive dataset data through a connection; model_connector apps connect models instead and do not accept dataset connections. Each result shows the installation id, the app id, the app’s name, and its categories. Use the installation id with narrative_app_profiles_list to find the profile a connection is created against.

narrative_app_profiles_list

Lists the profiles of an app installation in the currently selected company. A profile’s id is the profile_id that a dataset connection is created against, and only profiles with status enabled can back a connection. If no enabled profile exists, the user must create and enable one in the app’s UI before a connection can be created.

narrative_app_interfaces_list

Lists a connector app’s interfaces and their quick-settings JSON Schemas. Use the returned schema to construct the quick_settings object that narrative_connection_create accepts. Interface ids match the ones narrative_dataset_get_compatible_interfaces reports. Available include values:
Omit include=["collaboration_policy"] unless you need to explain why a specific dataset was rejected. Use narrative_dataset_get_compatible_interfaces to find accepted interfaces first, then call this tool for their quick_settings schemas only.

narrative_dataset_get_compatible_interfaces

Reports which installed connector interfaces accept a dataset’s schema. Run this before narrative_connection_create: an accepted (app_id, interface_id) pair means that connector can receive the dataset’s data. Available include values: Returns two sections: Accepted — the interfaces that can receive the dataset — and Incompatible — the ones that rejected the schema.

narrative_connection_create

Creates a connection from a dataset to a connector app, routing the dataset’s data to that destination. Returns the created connection’s id, app, dataset, profile, status, and creation timestamp. The connector validates the schema again at create time and rejects datasets that no longer match an interface.
Connections activate immediately. Confirm the dataset and profile with the user before calling this tool.

NQL tools

NQL tools let you validate, execute, and track NQL queries.

narrative_nql_validate

Compile-checks an NQL query without executing it. Returns the compiled SQL on success, or validation errors pointing to the offending part of the query.
Use narrative_nql_validate to test Rosetta Stone mapping expressions cheaply. Validate a candidate expression by running SELECT expression FROM company_data."dataset_id" through the tool — if it compiles, the expression is valid against the dataset’s schema.

narrative_nql_execute

Submits an NQL query to POST /v1/nql/execute for asynchronous execution. Supported statements are INSERT, UPDATE, DELETE, EXPLAIN, and CREATE MATERIALIZED VIEW; SELECT and MERGE are rejected. Returns the id of the workflow that runs the query and the id of the workflow run. Poll the run with narrative_workflow_runs_list(workflow_id=...), find the enqueued job with narrative_jobs_search(workflow_run_id=...), then read the result with narrative_jobs_describe.
The tool was previously named narrative_nql_run. The old name is still accepted and transparently routed to narrative_nql_execute, but new integrations should call narrative_nql_execute directly.

Job tools

Job tools let you discover and follow Narrative jobs — the asynchronous units of work spawned by narrative_nql_execute, dataset operations, and workflow runs. Jobs are generic across types; the type field on each response distinguishes nql-forecast, materialize-view, datasets_sample, and others.

narrative_jobs_describe

Describes one or more jobs by id in a single call. Use this to poll jobs through to completion — re-invoke until each job’s state is completed, failed, or cancelled. Available include values: Searches jobs by tags, state, type, dataset, or data plane. At least one filter must be supplied — calling with no filters returns an error rather than dumping the full corpus. Pass the returned ids to narrative_jobs_describe for full per-job detail. To find workflow-enqueued jobs, filter with workflow_run_id or workflow_id rather than the older tag convention.

Data plane tools

Data plane tools let you discover the data planes your company has access to. The ids returned here are used by workflow tools and the optional data_plane_id argument on narrative_nql_execute.

narrative_data_planes_list

Lists every data plane available to the active company, including Narrative-hosted and any company-owned planes.

narrative_data_planes_describe

Describes one or more data planes by id. Accepts multiple ids in a single call and fetches them in parallel. Available include values (shared by both data plane tools): Both tool descriptions carry usage guidance for connected AI assistants: compute pools with always_on: true skip cold-start cluster spin-up, making small always-on pools ideal for lightweight jobs like narrative_dataset_request_sample.

Workflow tools

Workflow tools let you submit, inspect, and track runs of workflows. The workflow YAML is passed as a free-form string — see the workflow task reference for the YAML shape.

narrative_workflows_create

Submits a new workflow from a YAML specification. Returns the created workflow’s id and metadata. When trigger_immediately=true, the response also includes a run_id you can poll with narrative_workflow_runs_list.

narrative_workflows_trigger

Triggers a new run of an existing workflow. Returns immediately with the new run’s id; poll the run’s status via narrative_workflow_runs_list.
Workflows created through this tool are automatically tagged with created_by_mcp_server so you can filter and audit agent-created workflows in the Narrative app. If the agent supplies the tag explicitly, it is not duplicated.

narrative_workflows_describe

Describes one or more workflows by id. Accepts multiple ids in a single call and fetches them in parallel. Available include values:
Avoid include=["specification"] when scanning many workflows. Request it only after you have narrowed to the ones you actually want to inspect.

narrative_workflow_runs_list

Lists runs of a single workflow, in the order the upstream returns them (typically most recent first). Mirrors the upstream paging surface — opaque cursor pagination via page_token. To find the jobs spawned by a specific run, call narrative_jobs_search with workflow_run_id=<run-uuid>.

Usage patterns

The most effective pattern for running queries is validate → execute → poll:
  1. Validate the query with narrative_nql_validate to catch syntax errors before enqueuing a workflow.
  2. Execute the validated query with narrative_nql_execute to submit it. The tool returns the workflow id and run id.
  3. Poll the run with narrative_workflow_runs_list(workflow_id=...) until it reaches a terminal state, then use narrative_jobs_search(workflow_run_id=...) and narrative_jobs_describe to read the result.
This avoids enqueuing work that would fail at compile time and keeps long-running executions out of the synchronous request path.

Dataset inspection flow

To understand a dataset’s structure and content:
  1. Search with narrative_datasets_search to find datasets by name or description.
  2. Describe with narrative_datasets_describe using include=["metadata", "schema"] for an overview, or add "sample" and "stats" for deeper inspection.
  3. Inspect columns with narrative_dataset_get_column_stats for detailed per-column statistics.

Access rule discovery flow

To find and inspect the access rules available to your company:
  1. Search with narrative_access_rules_search, providing at least one filter (e.g. search_term, exposed_attribute_names, tags, dataset_ids).
  2. Describe shortlisted rules with narrative_access_rules_describe using include=["metadata", "mappings"] for an overview, or add "nql", "schema", "collaborators", or "pricing" for deeper detail.
  3. Reference in NQL using <owning_company_slug>.<access_rule_name>.

Workflow submission flow

To submit and track a workflow from an AI assistant:
  1. Discover available data planes with narrative_data_planes_list to pick a data_plane_id.
  2. Create the workflow with narrative_workflows_create, passing the YAML as specification. Set trigger_immediately=true to start a run right away, or call narrative_workflows_trigger later.
  3. Poll runs with narrative_workflow_runs_list until the most recent run reaches a terminal state.
  4. Inspect job-level progress by calling narrative_jobs_search with workflow_run_id=<run-uuid>, then narrative_jobs_describe on the returned ids.
  5. Describe the workflow with narrative_workflows_describe to inspect its specification or current status.

Connection creation flow

To route a dataset’s data to a destination connector from an AI assistant:
  1. List installed connectors with narrative_installations_list and pick one whose categories include destination_connector.
  2. Find an enabled profile with narrative_app_profiles_list on the installation id. Only enabled profiles can back a connection.
  3. Check compatibility with narrative_dataset_get_compatible_interfaces for the target dataset. The accepted (app_id, interface_id) pairs are the ones a connection will succeed against.
  4. Build quick_settings (optional) with narrative_app_interfaces_list on the accepted interface’s app to retrieve the interface’s quick-settings JSON Schema.
  5. Create the connection with narrative_connection_create, passing dataset_id, the enabled profile_id, and any quick_settings.

Multi-company sessions

If you belong to multiple companies:
  1. List your companies with narrative_context_get_companies.
  2. Switch with narrative_context_set_company to set the active company.
  3. All subsequent tool calls operate against the selected company until you switch again.

Naming conventions

  • Plural names (datasets_describe, attributes_describe) accept multiple ids per call.
  • Singular names (dataset_get_column_stats, dataset_request_sample) operate on a single entity.
  • All tools use the narrative_ prefix.

Connecting to the Narrative MCP Server

Set up your MCP client

Data Collaboration MCP Server

How the MCP server works

NQL Design Philosophy

Understand the query language behind NQL tools

Rosetta Stone

The schema normalization system behind attribute tools