Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.narrative.io/llms.txt

Use this file to discover all available pages before exploring further.

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

https://mcp.narrative.io/mcp

Context tools

Context tools manage your authenticated session and company scope.

narrative_context_get_companies

Lists the companies the authenticated user belongs to.
ParameterTypeRequiredDescription
(none)Returns all companies for the current user
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.
ParameterTypeRequiredDescription
company_idintegerYesThe company to switch to

narrative_context_search_companies

Searches companies by name using case-insensitive substring matching. Available to global administrators only.
ParameterTypeRequiredDescription
querystringYesSearch term to match against company names
per_pageintegerNoResults per page (default: 50, max: 100)
Returns { id, name } for each matching company.

Dataset tools

Dataset tools let you search, describe, and inspect datasets. Finds datasets by name, description, or tags.
ParameterTypeRequiredDescription
search_termstringYesText to search across dataset names, descriptions, and tags

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.
ParameterTypeRequiredDescription
dataset_idsinteger[]YesOne or more dataset ids to describe
includestring[]NoSections to include (default: ["metadata", "schema"])
formatstringNoResponse format: "markdown" (default) or "json"
Available include values:
ValueDescription
metadataName, id, description, owner
schemaColumn types and attribute mappings
mappingsRosetta Stone mappings on the dataset
sampleSample rows
statsDataset-level statistics (not per-column)
column_stats_configWhich columns have statistics configured
retention_policyData retention settings
nqlGenerated NQL snippet to query the dataset

narrative_dataset_get_column_stats

Returns per-column statistics for a single dataset.
ParameterTypeRequiredDescription
dataset_idintegerYesThe dataset to inspect
columnsstring[]YesColumn names to retrieve stats for
includestring[]NoStat types to include (default: ["basic_column_stats"])
formatstringNoResponse format: "markdown" (default) or "json"
Available include values:
ValueDescription
basic_column_statsAll statistics except histogram — safe for context budget
histogramOpt-in; can produce large responses on wide columns

narrative_dataset_set_column_stats_config

Configures which columns have statistics collected on a dataset.
ParameterTypeRequiredDescription
dataset_idintegerYesThe dataset to configure
configobjectYesColumn statistics configuration

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.
ParameterTypeRequiredDescription
dataset_idintegerYesThe dataset to sample
compute_pool_idstringNoTarget a specific compute pool; otherwise uses the dataset’s configured pool
Returns the job id. Poll completion with narrative_nql_get_job.

narrative_dataset_refresh_materialized_view

Triggers a refresh of a materialized-view dataset.
ParameterTypeRequiredDescription
dataset_idintegerYesThe materialized view dataset to refresh
typestringYes"full" (reprocess all snapshots) or "incremental" (skip already-processed snapshots)
compute_pool_idstringNoTarget a specific compute pool
Returns the refresh job id. Poll completion with narrative_nql_get_job.

narrative_dataset_recalculate_statistics

Enqueues a column-statistics recalculation across the dataset’s snapshot range.
ParameterTypeRequiredDescription
dataset_idintegerYesThe dataset to recalculate stats for
from_snapshotstringNoStart from a specific snapshot; otherwise recalculates all snapshots in the stats configuration
Returns the recalculation id, queued snapshot count, and snapshot timestamp range.

Attribute tools

Attribute tools let you explore and inspect Rosetta Stone attributes. Searches Rosetta Stone attributes by name.
ParameterTypeRequiredDescription
search_termstringYesText to search across attribute names and descriptions
includestring[]NoSections to include (default: ["metadata"])
formatstringNoResponse format: "markdown" (default) or "json"
Available include values:
ValueDescription
metadataId, name, display name, description, type, tags
schemaProperties, required fields, enum values

narrative_attributes_describe

Describes one or more attributes by id. Accepts multiple attribute ids in a single call.
ParameterTypeRequiredDescription
attribute_idsinteger[]YesOne or more attribute ids to describe
includestring[]NoSections to include (default: ["metadata", "schema"])
formatstringNoResponse format: "markdown" (default) or "json"
Uses the same include values as narrative_attributes_search.

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.
ParameterTypeRequiredDescription
querystringYesThe NQL query to validate
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_run

Submits an NQL query for asynchronous execution. Supports SELECT queries, EXPLAIN forecasts, and CREATE MATERIALIZED VIEW statements.
ParameterTypeRequiredDescription
querystringYesThe NQL query to execute
data_plane_idstringNoTarget a specific data plane; otherwise uses the company default
compute_pool_idstringNoTarget a specific compute pool; otherwise uses the company default
Returns a job descriptor in state: pending with a polling hint.

narrative_nql_get_job

Polls a job by id to retrieve its current state, compiled SQL, result payload, and any failures.
ParameterTypeRequiredDescription
job_idstringYesThe job id to poll
data_plane_idstringNoThe data plane the job runs on
compute_pool_idstringNoThe compute pool the job runs on

Usage patterns

The most effective pattern for running queries is validate → run → poll:
  1. Validate the query with narrative_nql_validate to catch syntax errors before enqueuing a job.
  2. Run the validated query with narrative_nql_run to submit it for execution.
  3. Poll with narrative_nql_get_job until the job reaches a terminal state.
This avoids enqueuing jobs 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.

Multi-company workflows

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