Skip to main content
Glama
LangSmith MCP Server

LangSmith MCP Server

Official
by langchain-ai

πŸ¦œπŸ› οΈ LangSmith MCP Server

LangSmith MCP Hero

License: MIT Python 3.10

A production-ready Model Context Protocol (MCP) server that provides seamless integration with the LangSmith observability platform. This server enables language models to fetch conversation history, prompts, runs and traces, datasets, experiments, and billing usage from LangSmith.

πŸ“‹ Example Use Cases

The server enables powerful capabilities including:

  • πŸ’¬ Conversation History: "Fetch the history of my conversation from thread 'thread-123' in project 'my-chatbot'" (paginated by character budget)

  • πŸ“š Prompt Management: "Get all public prompts in my workspace" / "Pull the template for the 'legal-case-summarizer' prompt"

  • πŸ” Traces & Runs: "Fetch the latest 10 root runs from project 'alpha'" / "Get all runs for trace <uuid> (page 2 of 5)"

  • πŸ“Š Datasets: "List datasets of type chat" / "Read examples from dataset 'customer-support-qa'"

  • πŸ§ͺ Experiments: "List experiments for dataset 'my-eval-set' with latency and cost metrics"

  • πŸ“ˆ Billing: "Get billing usage for September 2025"

Related MCP server: AgentLens MCP Server

πŸš€ Quickstart

A hosted version of the LangSmith MCP Server is available over HTTP-streamable transport, so you can connect without running the server yourself:

  • URL: https://langsmith-mcp-server.onrender.com/mcp

  • Hosting: Render, built from this public repo using the project's Dockerfile.

Use it like any HTTP-streamable MCP server: point your client at the URL and send your LangSmith API key in the LANGSMITH-API-KEY header. No local install or Docker required.

Example (Cursor mcp.json):

{
  "mcpServers": {
    "LangSmith MCP (Hosted)": {
      "url": "https://langsmith-mcp-server.onrender.com/mcp",
      "headers": {
        "LANGSMITH-API-KEY": "lsv2_pt_your_api_key_here"
      }
    }
  }
}

Optional headers: LANGSMITH-WORKSPACE-ID, LANGSMITH-ENDPOINT (same as in the Docker Deployment section below).

Note: This deployed instance is intended for LangSmith Cloud. If you use a self-hosted LangSmith instance, run the server yourself and point it at your endpointβ€”see the Docker Deployment section below.

πŸ› οΈ Available Tools

The LangSmith MCP Server provides the following tools for integration with LangSmith.

πŸ’¬ Conversation & Threads

Tool Name

Description

get_thread_history

Retrieve message history for a conversation thread. Uses char-based pagination: pass page_number (1-based), and use returned total_pages to request more pages. Optional max_chars_per_page and preview_chars control page size and long-string truncation.

πŸ“š Prompt Management

Tool Name

Description

list_prompts

Fetch prompts from LangSmith with optional filtering by visibility (public/private) and limit.

get_prompt_by_name

Get a specific prompt by its exact name, returning the prompt details and template.

push_prompt

Documentation-only: how to create and push prompts to LangSmith.

πŸ” Traces & Runs

Tool Name

Description

fetch_runs

Fetch LangSmith runs (traces, tools, chains, etc.) from one or more projects. Supports filters (run_type, error, is_root), FQL (filter, trace_filter, tree_filter), and ordering. When trace_id is set, returns char-based paginated pages; otherwise returns one batch up to limit. Always pass limit and page_number.

list_projects

List LangSmith projects with optional filtering by name, dataset, and detail level (simplified vs full).

πŸ“Š Datasets & Examples

Tool Name

Description

list_datasets

Fetch datasets with filtering by ID, type, name, name substring, or metadata.

list_examples

Fetch examples from a dataset by dataset ID/name or example IDs, with filter, metadata, splits, and optional as_of version.

read_dataset

Read a single dataset by ID or name.

read_example

Read a single example by ID, with optional as_of version.

create_dataset

Documentation-only: how to create datasets in LangSmith.

update_examples

Documentation-only: how to update dataset examples in LangSmith.

πŸ§ͺ Experiments & Evaluations

Tool Name

Description

list_experiments

List experiment projects (reference projects) for a dataset. Requires reference_dataset_id or reference_dataset_name. Returns key metrics (latency, cost, feedback stats).

run_experiment

Documentation-only: how to run experiments and evaluations in LangSmith.

πŸ“ˆ Usage & Billing

Tool Name

Description

get_billing_usage

Fetch organization billing usage (e.g. trace counts) for a date range. Optional workspace filter; returns metrics with workspace names inline.

πŸ“„ Pagination (char-based)

Several tools use stateless, character-budget pagination so responses stay within a size limit and work well with LLM clients:

  • Where it’s used: get_thread_history and fetch_runs (when trace_id is set).

  • Parameters: You send page_number (1-based) on every request. Optional: max_chars_per_page (default 25000, cap 30000) and preview_chars (truncate long strings with "… (+N chars)").

  • Response: Each response includes page_number, total_pages, and the page payload (result for messages, runs for runs). To get more, call again with page_number = 2, then 3, up to total_pages.

  • Why it’s useful: Pages are built by JSON character count, not item count, so each page fits within a fixed size. No cursor or server-side stateβ€”just integer page numbers.

πŸ› οΈ Installation Options

πŸ“ General Prerequisites

  1. Install uv (a fast Python package installer and resolver):

    curl -LsSf https://astral.sh/uv/install.sh | sh
  2. Clone this repository and navigate to the project directory:

    git clone https://github.com/langchain-ai/langsmith-mcp-server.git
    cd langsmith-mcp-server

πŸ”Œ MCP Client Integration

Once you have the LangSmith MCP Server, you can integrate it with various MCP-compatible clients. You have two installation options:

πŸ“¦ From PyPI

  1. Install the package:

    uv run pip install --upgrade langsmith-mcp-server
  2. Add to your client MCP config:

    {
        "mcpServers": {
            "LangSmith API MCP Server": {
                "command": "/path/to/uvx",
                "args": [
                    "langsmith-mcp-server"
                ],
                "env": {
                    "LANGSMITH_API_KEY": "your_langsmith_api_key",
                    "LANGSMITH_WORKSPACE_ID": "your_workspace_id",
                    "LANGSMITH_ENDPOINT": "https://api.smith.langchain.com"
                }
            }
        }
    }

βš™οΈ From Source

Add the following configuration to your MCP client settings (run from the project root so the package is found):

{
    "mcpServers": {
        "LangSmith API MCP Server": {
            "command": "/path/to/uv",
            "args": [
                "--directory",
                "/path/to/langsmith-mcp-server",
                "run",
                "langsmith_mcp_server/server.py"
            ],
            "env": {
                "LANGSMITH_API_KEY": "your_langsmith_api_key",
                "LANGSMITH_WORKSPACE_ID": "your_workspace_id",
                "LANGSMITH_ENDPOINT": "https://api.smith.langchain.com"
            }
        }
    }
}

Replace the following placeholders:

  • /path/to/uv: The absolute path to your uv installation (e.g., /Users/username/.local/bin/uv). You can find it with which uv.

  • /path/to/langsmith-mcp-server: The absolute path to the project root (the directory containing pyproject.toml and langsmith_mcp_server/).

  • your_langsmith_api_key: Your LangSmith API key (required).

  • your_workspace_id: Your LangSmith workspace ID (optional, for API keys scoped to multiple workspaces).

  • https://api.smith.langchain.com: The LangSmith API endpoint (optional, defaults to the standard endpoint).

Example configuration (PyPI/uvx):

{
    "mcpServers": {
        "LangSmith API MCP Server": {
            "command": "/path/to/uvx",
            "args": ["langsmith-mcp-server"],
            "env": {
                "LANGSMITH_API_KEY": "lsv2_pt_your_key_here",
                "LANGSMITH_WORKSPACE_ID": "your_workspace_id",
                "LANGSMITH_ENDPOINT": "https://api.smith.langchain.com"
            }
        }
    }
}

Copy this configuration into Cursor β†’ MCP Settings (replace /path/to/uvx with the output of which uvx).

LangSmith Cursor Integration

πŸ”§ Headers (tool invocation)

When connecting over HTTP (e.g. streamable HTTP or a hosted MCP endpoint), the server uses headers for authentication and configuration. Your MCP client must send these with each request; no environment variables are required for tool invocation.

Header

Required

Description

LANGSMITH-API-KEY

βœ… Yes

Your LangSmith API key for tool calls (list prompts, fetch runs, etc.)

LANGSMITH-WORKSPACE-ID

❌ No

Workspace ID for API keys scoped to multiple workspaces

LANGSMITH-ENDPOINT

❌ No

Custom API endpoint URL (for self-hosted or EU region)

Optional headers used only when server monitoring is enabled (for grouping traces by session):

Header

Description

mcp-session-id

Session or thread id; stored in trace metadata as session_id

x-session-id

Fallback if mcp-session-id is not set

x-request-id

Fallback for request-scoped grouping

Stdio transport: When running the server over stdio (e.g. uvx langsmith-mcp-server), there are no headers. The server falls back to the environment variables LANGSMITH_API_KEY, LANGSMITH_WORKSPACE_ID, and LANGSMITH_ENDPOINT in the process environment so that tool invocation still works.


πŸ”§ Environment variables

Environment variables are not used for tool invocation when using HTTP (headers are). They are used for:

  1. Stdio transport – fallback for credentials when no headers exist (see above).

  2. Load tests – e.g. tests/load_test_sessions.py reads LANGSMITH_API_KEY from the environment (or a .env file at the project root).

  3. Optional server monitoring – tracing tool calls to a second LangSmith instance (see below).

Variable

Used for

Description

LANGSMITH_API_KEY

Stdio fallback, load tests

LangSmith API key (when not provided via headers)

LANGSMITH_WORKSPACE_ID

Stdio fallback

Workspace ID (optional)

LANGSMITH_ENDPOINT

Stdio fallback

Custom endpoint URL (optional)

Optional: Tool-call monitoring to a second LangSmith instance

You can log every MCP tool call (with inputs and outputs) to a separate LangSmith project for monitoring and analytics. Set these in your environment (e.g. in a .env file at the project root; the server loads .env via python-dotenv):

Variable

Required

Description

LANGSMITH_MONITORING_API_KEY

Yes (to enable)

API key for the LangSmith instance used for monitoring

LANGSMITH_MONITORING_ENDPOINT

No

Endpoint URL (default: cloud)

LANGSMITH_MONITORING_WORKSPACE_ID

No

Workspace ID for the monitoring instance

LANGSMITH_MONITORING_PROJECT

No

Project name for monitoring traces (default: mcp-server-monitoring)

LANGSMITH_TRACING

Yes (to send traces)

Set to true so traces are sent to LangSmith (custom instrumentation)

Each tool run is traced with run_type="tool" and a session_id in metadata (from the mcp-session-id, x-session-id, or x-request-id header when using HTTP, or generated per request).

If you use the hosted LangSmith MCP Server, anonymous usage data is sent to a separate LangSmith project so we can iterate and improve the product.

🐳 Docker Deployment (HTTP-Streamable)

The LangSmith MCP Server can be deployed as an HTTP server using Docker, enabling remote access via the HTTP-streamable protocol.

Building the Docker Image

docker build -t langsmith-mcp-server .

Running with Docker

docker run -p 8000:8000 langsmith-mcp-server

The API key is provided via the LANGSMITH-API-KEY header when connecting, so no environment variables are required for HTTP-streamable protocol.

Connecting with HTTP-Streamable Protocol

Once the Docker container is running, you can connect to it using the HTTP-streamable transport. The server accepts authentication via headers:

Required header:

  • LANGSMITH-API-KEY: Your LangSmith API key

Optional headers:

  • LANGSMITH-WORKSPACE-ID: Workspace ID for API keys scoped to multiple workspaces

  • LANGSMITH-ENDPOINT: Custom endpoint URL (for self-hosted or EU region)

Example client configuration:

from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client

headers = {
    "LANGSMITH-API-KEY": "lsv2_pt_your_api_key_here",
    # Optional:
    # "LANGSMITH-WORKSPACE-ID": "your_workspace_id",
    # "LANGSMITH-ENDPOINT": "https://api.smith.langchain.com",
}

async with streamablehttp_client("http://localhost:8000/mcp", headers=headers) as (read, write, _):
    async with ClientSession(read, write) as session:
        await session.initialize()
        # Use the session to call tools, list prompts, etc.

Cursor Integration

To add the LangSmith MCP Server to Cursor using HTTP-streamable protocol, add the following to your mcp.json configuration file:

{
  "mcpServers": {
    "HTTP-Streamable LangSmith MCP Server": {
      "url": "http://localhost:8000/mcp",
      "headers": {
        "LANGSMITH-API-KEY": "lsv2_pt_your_api_key_here"
      }
    }
  }
}

Optional headers:

{
  "mcpServers": {
    "HTTP-Streamable LangSmith MCP Server": {
      "url": "http://localhost:8000/mcp",
      "headers": {
        "LANGSMITH-API-KEY": "lsv2_pt_your_api_key_here",
        "LANGSMITH-WORKSPACE-ID": "your_workspace_id",
        "LANGSMITH-ENDPOINT": "https://api.smith.langchain.com"
      }
    }
  }
}

Make sure the server is running before connecting Cursor to it.

Health Check

The server provides a health check endpoint:

curl http://localhost:8000/health

This endpoint does not require authentication and returns "LangSmith MCP server is running" when the server is healthy.

πŸ§ͺ Development and Contributing

Prerequisites

  • Python 3.10+ (3.11+ recommended)

  • uv – install with curl -LsSf https://astral.sh/uv/install.sh | sh

  • LangSmith API key – from smith.langchain.com

  • Node.js (optional) – only if you want to use MCP Inspector to test the server (stdio or streamable-http)

Setup

git clone https://github.com/langchain-ai/langsmith-mcp-server.git
cd langsmith-mcp-server

uv sync                    # Install dependencies
uv sync --group test       # Include test dependencies (pytest, ruff, mypy)

uvx langsmith-mcp-server   # Verify CLI runs (stdio)

Development workflow

  1. Edit code in langsmith_mcp_server/ or tests/.

  2. Format and lint (required before committing):

    make format
    make lint
  3. Run tests:

    make test
    # Or a single file:
    make test TEST_FILE=tests/tools/test_dataset_tools.py
  4. Type-check (optional): uv run mypy langsmith_mcp_server/

Testing with MCP Inspector

You can test the server with MCP Inspector using either stdio or streamable-http.

  1. Start MCP Inspector:

    npx @modelcontextprotocol/inspector@latest

    Open http://localhost:6274 in your browser.

  2. Connect in the Inspector:

    • Stdio: Choose stdio transport and configure the server command (e.g. uv run langsmith-mcp-server) and set LANGSMITH_API_KEY in the environment.

    • Streamable HTTP: Start the server first (uv run uvicorn langsmith_mcp_server.server:app --host 0.0.0.0 --port 8000 or Docker), then choose streamable-http, URL http://localhost:8000/mcp, and add header LANGSMITH-API-KEY = your API key.

Load testing

A session-based load test opens many MCP sessions and calls the list_prompts tool in each, using langchain-mcp-adapters. Run from the CLI (no UI). The server must be running first.

uv sync --group load
# Terminal 1: start the server
uv run uvicorn langsmith_mcp_server.server:app --host 0.0.0.0 --port 8000
# Terminal 2: run the load test
uv run python tests/load_test_sessions.py --sessions 20 --calls-per-session 3

Options

Option

Default

Description

--url

http://localhost:8000/mcp

MCP endpoint URL

--api-key

from .env

LANGSMITH_API_KEY (or set in project root .env)

--sessions

10

Number of concurrent sessions

--calls-per-session

3

list_prompts calls per session

--debug

off

Print step-by-step logs and first error traceback

--report PATH

β€”

Write a report after the run (see below)

Report

Use --report PATH to write a JSON report after the test (e.g. --report load_test_report creates load_test_report.json with config, summary, per-session results, and first error).

uv run python tests/load_test_sessions.py --sessions 5 --report load_test_report
# Creates: load_test_report.json (in current directory)

Contributing checklist

Before opening a PR:

  • make format and make lint pass

  • make test passes

  • New tools or behavior are documented (e.g. in CLAUDE.md if you change architecture or tools)

  • Error handling in tools returns {"error": "..."} rather than raising

For more detail (adding tools, code standards, troubleshooting), see CLAUDE.md.

πŸ“„ License

This project is distributed under the MIT License. For detailed terms and conditions, please refer to the LICENSE file.

Made with ❀️ by the LangChain Team

Available Tools

13 tools
create_datasetC

Call this tool when you need to understand how to create datasets in LangSmith.

Inputs: no named parameters. Returns: result

fetch_runsA

Fetch LangSmith runs (traces, tools, chains, etc.) from one or more projects using flexible filters, query language expressions, and trace-level constraints.


🧩 PURPOSE

This is a general-purpose LangSmith run fetcher designed for analytics, trace export, and automated exploration.

It wraps client.list_runs() with complete support for:

  • Multiple project names or IDs

  • The Filter Query Language (FQL) for precise queries

  • Hierarchical filtering across trace trees

  • Sorting and result limiting

It returns raw dict objects suitable for further analysis or export.


βš™οΈ PARAMETERS

project_name : str The project name to fetch runs from. For multiple projects, use JSON array string (e.g., '["project1", "project2"]').

trace_id : str, optional Return only runs that belong to a specific trace tree. It is a UUID string, e.g. "123e4567-e89b-12d3-a456-426614174000".

run_type : str, optional Filter runs by type (e.g. "llm", "chain", "tool", "retriever").

error : str, optional Filter by error status: "true" for errored runs, "false" for successful runs.

is_root : str, optional Filter root traces: "true" for only top-level traces, "false" to exclude roots. If not provided, returns all runs.

filter : str, optional A Filter Query Language (FQL) expression that filters runs by fields, metadata, tags, feedback, latency, or time.

─── Common field names ───
- `id`, `name`, `run_type`
- `start_time`, `end_time`
- `latency`
- `total_tokens`
- `error`
- `tags`
- `feedback_key`, `feedback_score`
- `metadata_key`, `metadata_value`
- `execution_order`

─── Supported comparators ───
- `eq`, `neq` β†’ equal / not equal
- `gt`, `gte`, `lt`, `lte` β†’ numeric or time comparisons
- `has` β†’ tag or metadata contains value
- `search` β†’ substring or full-text match
- `and`, `or`, `not` β†’ logical operators

─── Examples ───
```python
'gt(latency, "5s")'                                # took longer than 5 seconds
'neq(error, null)'                                  # errored runs
'has(tags, "beta")'                                 # runs tagged "beta"
'and(eq(name,"ChatOpenAI"), eq(run_type,"llm"))'    # named & typed runs
'search("image classification")'                    # full-text search
```

trace_filter : str, optional Filter applied to the root run in each trace tree. Lets you select child runs based on root attributes or feedback.

Example:
```python
'and(eq(feedback_key,"user_score"), eq(feedback_score,1))'
```
β†’ return runs whose root trace has a user_score of 1.

tree_filter : str, optional Filter applied to any run in the trace tree (including siblings or children). Example: python 'eq(name,"ExpandQuery")' β†’ return runs if any run in their trace had that name.

order_by : str, default "-start_time" Sort field; prefix with "-" for descending order.

limit : int, default 50 Maximum number of runs to return.

reference_example_id : str, optional Filter runs by reference example ID. Returns only runs associated with the specified dataset example ID.

format_type : str, default "pretty" Output format for extracted messages. Options: - "pretty" (default): Human-readable formatted text focusing on human/AI/tool message exchanges - "json": Pretty-printed JSON format - "raw": Compact single-line JSON format

When format_type is set, the tool extracts messages from runs and formats them,
making it ideal for conversational AI agents that care about message exchanges
rather than full trace details. The response returns only the formatted output:
- `formatted`: Formatted string representation of messages (when format_type is provided)

When format_type is not set, the response returns:
- `runs`: Full run data

πŸ“€ RETURNS

Dict[str, Any] Dictionary containing: - If format_type is set: {"formatted": str} - formatted string representation of messages - If format_type is not set: {"runs": List[Dict]} - list of LangSmith run dictionaries


πŸ§ͺ EXAMPLES

1️⃣ Get latest 10 root runs

runs = fetch_runs("alpha-project", is_root="true", limit=10)

2️⃣ Get all tool runs that errored

runs = fetch_runs("alpha-project", run_type="tool", error="true")

3️⃣ Get all runs that took >5s and have tag "experimental"

runs = fetch_runs("alpha-project", filter='and(gt(latency,"5s"), has(tags,"experimental"))')

4️⃣ Get all runs in a specific conversation thread

thread_id = "abc-123"
fql = f'and(in(metadata_key, ["session_id","conversation_id","thread_id"]), eq(metadata_value, "{thread_id}"))'
runs = fetch_runs("alpha-project", is_root="true", filter=fql)

5️⃣ List all runs called "extractor" whose root trace has feedback user_score=1

runs = fetch_runs(
    "alpha-project",
    filter='eq(name,"extractor")',
    trace_filter='and(eq(feedback_key,"user_score"), eq(feedback_score,1))'
)

6️⃣ List all runs that started after a timestamp and either errored or got low feedback

fql = 'and(gt(start_time,"2023-07-15T12:34:56Z"), or(neq(error,null), and(eq(feedback_key,"Correctness"), eq(feedback_score,0.0))))'
runs = fetch_runs("alpha-project", filter=fql)

7️⃣ Get formatted messages for conversational AI (default: pretty format)

# Returns formatted messages focusing on human/AI/tool exchanges
result = fetch_runs("alpha-project", limit=10, format_type="pretty")
# result["formatted"] contains human-readable formatted messages
# result["messages"] contains the raw message list
# result["runs"] contains full run data

8️⃣ Get messages in JSON format

result = fetch_runs("alpha-project", limit=10, format_type="json")
# result["messages"] contains messages as JSON array
# result["formatted"] contains pretty-printed JSON string

🧠 NOTES FOR AGENTS

  • Use this to query LangSmith data sources dynamically.

  • Compose FQL strings programmatically based on your intent.

  • Combine filter, trace_filter, and tree_filter for hierarchical logic.

  • Always verify that project_name matches an existing LangSmith project.

  • Returned dict objects have fields like:

  • id, name, run_type, inputs, outputs, error, start_time, end_time, latency, metadata, feedback, etc.

  • If the trace is big, save it to a file (if you have this ability) and analyze it locally.

  • For conversational AI agents: Use format_type="pretty" (default) to get human-readable message exchanges focusing on human/AI/tool messages rather than full trace details.

Inputs: project_name (required), trace_id, run_type, error, +8 more. Returns: object

get_prompt_by_nameA

Get a specific prompt by its exact name.

Args: prompt_name (str): The exact name of the prompt to retrieve ctx: FastMCP context (automatically provided)

Returns: Dict[str, Any]: Dictionary containing the prompt details and template, or an error message if the prompt cannot be found

Inputs: prompt_name (required). Returns: object

list_datasetsA

Fetch LangSmith datasets.

Note: If no arguments are provided, all datasets will be returned.

Args: dataset_ids (Optional[str]): Dataset IDs to filter by as JSON array string (e.g., '["id1", "id2"]') or single ID data_type (Optional[str]): Filter by dataset data type (e.g., 'chat', 'kv') dataset_name (Optional[str]): Filter by exact dataset name dataset_name_contains (Optional[str]): Filter by substring in dataset name metadata (Optional[str]): Filter by metadata as JSON object string (e.g., '{"key": "value"}') limit (int): Max number of datasets to return (default: 20) ctx: FastMCP context (automatically provided)

Returns: Dict[str, Any]: Dictionary containing the datasets and metadata, or an error message if the datasets cannot be retrieved

Inputs: dataset_ids, data_type, dataset_name, dataset_name_contains, +2 more. Returns: object

list_examplesA

Fetch examples from a LangSmith dataset with advanced filtering options.

Note: Either dataset_id, dataset_name, or example_ids must be provided. If multiple are provided, they are used in order of precedence: example_ids, dataset_id, dataset_name.

Args: dataset_id (Optional[str]): Dataset ID to retrieve examples from dataset_name (Optional[str]): Dataset name to retrieve examples from example_ids (Optional[str]): Specific example IDs as JSON array string (e.g., '["id1", "id2"]') or single ID limit (int): Maximum number of examples to return (default: 10) offset (int): Number of examples to skip (default: 0) filter (Optional[str]): Filter string using LangSmith query syntax (e.g., 'has(metadata, {"key": "value"})') metadata (Optional[str]): Metadata to filter by as JSON object string (e.g., '{"key": "value"}') splits (Optional[str]): Dataset splits as JSON array string (e.g., '["train", "test"]') or single split inline_s3_urls (Optional[str]): Whether to inline S3 URLs: "true" or "false" (default: SDK default if not specified) include_attachments (Optional[str]): Whether to include attachments: "true" or "false" (default: SDK default if not specified) as_of (Optional[str]): Dataset version tag OR ISO timestamp to retrieve examples as of that version/time ctx: FastMCP context (automatically provided)

Returns: Dict[str, Any]: Dictionary containing the examples and metadata, or an error message if the examples cannot be retrieved

Inputs: dataset_id, dataset_name, example_ids, filter, +7 more. Returns: object

list_experimentsA

List LangSmith experiment projects (reference projects) with mandatory dataset filtering.

Fetches experiment projects from LangSmith that are associated with a specific dataset. These are projects used for model evaluation and comparison. Requires either a dataset ID or dataset name to filter experiments.


🧩 PURPOSE

This function provides a convenient way to list and explore LangSmith experiment projects. It supports:

  • Filtering experiments by reference dataset (mandatory)

  • Filtering projects by name (partial match)

  • Limiting the number of results

  • Automatically extracting deployment IDs from nested project data

  • Returns simplified project information with key metrics (latency, cost, feedback stats)


βš™οΈ PARAMETERS

reference_dataset_id : str, optional The ID of the reference dataset to filter experiments by. Either this OR reference_dataset_name must be provided (but not both).

reference_dataset_name : str, optional The name of the reference dataset to filter experiments by. Either this OR reference_dataset_id must be provided (but not both).

limit : int, default 5 Maximum number of experiments to return. This can be adjusted by agents or users based on their needs.

project_name : str, optional Filter projects by name using partial matching. If provided, only projects whose names contain this string will be returned. Example: project_name="Chat" will match "Chat-LangChain", "ChatBot", etc.


πŸ“€ RETURNS

Dict[str, Any] A dictionary containing an "experiments" key with a list of simplified experiment project dictionaries:

```python
{
    "experiments": [
        {
            "name": "Experiment-Chat-LangChain",
            "experiment_id": "787d5165-f110-43ff-a3fb-66ea1a70c971",
            "feedback_stats": {...},  # Feedback statistics if available
            "latency_p50_seconds": 1.626,  # 50th percentile latency in seconds
            "latency_p99_seconds": 2.390,   # 99th percentile latency in seconds
            "total_cost": 0.00013005,       # Total cost in dollars
            "prompt_cost": 0.00002085,      # Prompt cost in dollars
            "completion_cost": 0.0001092,   # Completion cost in dollars
            "agent_deployment_id": "deployment-123"  # Only if available
        },
        ...
    ]
}
```

πŸ§ͺ EXAMPLES

1️⃣ List experiments for a dataset by ID

experiments = list_experiments(reference_dataset_id="f5ca13c6-96ad-48ba-a432-ebb6bf94528f")

2️⃣ List experiments for a dataset by name

experiments = list_experiments(reference_dataset_name="my-dataset", limit=10)

3️⃣ Find experiments with specific name pattern

experiments = list_experiments(
    reference_dataset_id="f5ca13c6-96ad-48ba-a432-ebb6bf94528f",
    project_name="Chat",
    limit=1
)

🧠 NOTES FOR AGENTS

  • Returns simplified experiment information with key metrics (latency, cost, feedback stats)

  • The agent_deployment_id field is automatically extracted from nested project data when available, making it easy to identify agent deployments

  • Experiments are filtered to include only reference projects (associated with datasets)

  • The function uses name_contains for filtering, so partial matches work

  • You must provide either reference_dataset_id OR reference_dataset_name, but not both

  • Experiment projects are used for model evaluation and comparison across different runs

Inputs: reference_dataset_id, reference_dataset_name, limit, project_name. Returns: object

list_projectsA

List LangSmith projects with optional filtering and detail level control.

Fetches projects from LangSmith, optionally filtering by name and controlling the level of detail returned. Can return either simplified project information or full project details. In case a dataset id or name is provided, you don't need to provide a project name.


🧩 PURPOSE

This function provides a convenient way to list and explore LangSmith projects. It supports:

  • Filtering projects by name (partial match)

  • Limiting the number of results

  • Choosing between simplified or full project information

  • Automatically extracting deployment IDs from nested project data


βš™οΈ PARAMETERS

limit : int, default 5 Maximum number of projects to return (as string, e.g., "5"). This can be adjusted by agents or users based on their needs.

project_name : str, optional Filter projects by name using partial matching. If provided, only projects whose names contain this string will be returned. Example: project_name="Chat" will match "Chat-LangChain", "ChatBot", etc.

more_info : str, default "false" Controls the level of detail returned: - "false" (default): Returns simplified project information with only essential fields: name, project_id, and agent_deployment_id (if available) - "true": Returns full project details as returned by the LangSmith API

reference_dataset_id : str, optional The ID of the reference dataset to filter projects by. Either this OR reference_dataset_name must be provided (but not both).

reference_dataset_name : str, optional The name of the reference dataset to filter projects by. Either this OR reference_dataset_id must be provided (but not both).


πŸ“€ RETURNS

List[dict] A list of project dictionaries. The structure depends on more_info:

**When `more_info=False` (simplified):**
```python
[
    {
        "name": "Chat-LangChain",
        "project_id": "787d5165-f110-43ff-a3fb-66ea1a70c971",
        "agent_deployment_id": "deployment-123"  # Only if available
    },
    ...
]
```

**When `more_info=True` (full details):**
Returns complete project objects with all fields from the LangSmith API,
including metadata, settings, statistics, and nested structures.

πŸ§ͺ EXAMPLES

1️⃣ List first 5 projects (simplified)

projects = list_projects(limit="5")

2️⃣ Search for projects with "Chat" in the name

projects = list_projects(project_name="Chat", limit="10")

3️⃣ Get full project details

projects = list_projects(limit="3", more_info="true")

4️⃣ Find a specific project with full details

projects = list_projects(project_name="MyProject", more_info="true", limit="1")

🧠 NOTES FOR AGENTS

  • Use more_info="false" for quick project discovery and listing

  • Use more_info="true" when you need detailed project information

  • The agent_deployment_id field is automatically extracted from nested project data when available, making it easy to identify agent deployments

  • Projects are filtered to exclude reference projects by default

  • The function uses name_contains for filtering, so partial matches work

Inputs: limit, project_name, more_info, reference_dataset_id, +1 more. Returns: object

list_promptsB

Fetch prompts from LangSmith with optional filtering.

Args: is_public (str): Filter by prompt visibility - "true" for public prompts, "false" for private prompts (default: "false") limit (int): Maximum number of prompts to return (default: 20)

Returns: Dict[str, Any]: Dictionary containing the prompts and metadata

Inputs: is_public, limit. Returns: object

push_promptC

Call this tool when you need to understand how to create and push prompts to LangSmith.

Inputs: no named parameters. Returns: result

read_datasetA

Read a specific dataset from LangSmith.

Note: Either dataset_id or dataset_name must be provided to identify the dataset. If both are provided, dataset_id takes precedence.

Args: dataset_id (Optional[str]): Dataset ID to retrieve dataset_name (Optional[str]): Dataset name to retrieve ctx: FastMCP context (automatically provided)

Returns: Dict[str, Any]: Dictionary containing the dataset details, or an error message if the dataset cannot be retrieved

Example in case you need to create a separate python script to read a dataset: ```python from langsmith import Client

client = Client()
dataset = client.read_dataset(dataset_name="My Dataset")
# Or by ID:
# dataset = client.read_dataset(dataset_id="dataset-id-here")
```

Inputs: dataset_id, dataset_name. Returns: object

read_exampleA

Read a specific example from LangSmith.

Args: example_id (str): Example ID to retrieve as_of (Optional[str]): Dataset version tag OR ISO timestamp to retrieve the example as of that version/time ctx: FastMCP context (automatically provided)

Returns: Dict[str, Any]: Dictionary containing the example details, or an error message if the example cannot be retrieved

Example in case you need to create a separate python script to read an example: ```python from langsmith import Client

client = Client()
example = client.read_example(example_id="example-id-here")
# Or with version:
# example = client.read_example(example_id="example-id-here", as_of="v1.0")
```

Inputs: example_id (required), as_of. Returns: object

run_experimentC

Call this tool when you need to understand how to run experiments and evaluations in LangSmith.

Inputs: no named parameters. Returns: result

update_examplesC

Call this tool when you need to understand how to update dataset examples in LangSmith.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 13 tools

    Disambiguation4/5

    Most tools have distinct purposes targeting different LangSmith resources like datasets, examples, prompts, runs, projects, and experiments, with clear boundaries. However, 'create_dataset' and 'push_prompt' are described as informational tools ('call this tool when you need to understand how to...'), which could confuse agents about their actual functionality versus other tools that perform operations directly.

    Naming Consistency5/5

    Tool names follow a highly consistent verb_noun pattern throughout, such as 'create_dataset', 'fetch_runs', 'list_datasets', 'read_example', and 'update_examples'. All tools use snake_case with clear, descriptive names, making the set predictable and easy to navigate.

    Tool Count5/5

    With 13 tools, the server is well-scoped for managing LangSmith resources, covering datasets, examples, prompts, runs, projects, and experiments. Each tool serves a specific function without redundancy, and the count aligns with the complexity of the domain, providing comprehensive coverage without being overwhelming.

    Completeness4/5

    The tool set offers strong coverage for core LangSmith operations, including CRUD-like actions for datasets, examples, prompts, runs, projects, and experiments. Minor gaps exist, such as no explicit 'delete' tools for resources like datasets or prompts, but agents can likely work around this given the overall robust surface for analytics and management tasks.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers