
Langfuse
- 113 installs
- 102 repo stars
- Updated June 27, 2026
- avivsinai/langfuse-mcp
langfuse is a Claude Code skill for debugging AI agents and LLM applications through the Langfuse MCP observability server.
About
langfuse is a Claude Code skill for debugging AI agents and LLM applications through Langfuse observability via the langfuse-mcp server. It provides playbooks that move from broad trace discovery to a root-cause hypothesis, covering exceptions, traces, slow generations, sessions, prompt versions, and datasets. A developer uses it when investigating what went wrong or why an LLM call is slow. It documents the highest-value MCP tools such as find_exceptions, fetch_trace, and fetch_observations.
- Debug AI agents and LLM apps through Langfuse observability via the langfuse-mcp server
- Playbooks for exception triage, trace inspection, latency analysis, sessions, prompts, and datasets
- Includes read-only mode and setup steps for connecting langfuse-mcp to Claude Code or Codex
Langfuse by the numbers
- 113 all-time installs (skills.sh)
- Ranked #235 of 596 Debugging skills by installs in the Skillselion catalog
- Data as of Jul 30, 2026 (Skillselion catalog sync)
langfuse capabilities & compatibility
Requires Langfuse public and secret API keys; Langfuse Cloud has a free tier, or self-host.
- Capabilities
- llm observability · exception triage · trace inspection · latency analysis
- Works with
- anthropic · openai
- Use cases
- debugging · data analysis
- Runs
- Runs locally
- Pricing
- Bring your own API key
What langfuse says it does
Debug AI agents and LLM applications via Langfuse MCP. Use when investigating traces, exceptions, slow generations, sessions, prompt versions, datasets, or evaluation sets.
This skill is the agent-facing companion to `langfuse-mcp`.
npx skills add https://github.com/avivsinai/langfuse-mcp --skill langfuseAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 113 |
|---|---|
| repo stars | ★ 102 |
| Last updated | June 27, 2026 |
| Repository | avivsinai/langfuse-mcp ↗ |
What it does
Investigating exceptions, slow generations, and traces in an LLM app using Langfuse via MCP.
Who is it for?
Investigating exceptions, slow generations, traces, sessions, prompt versions, and datasets in an LLM application.
Skip if: Tasks unrelated to LLM observability or without a Langfuse instance and keys.
When should I use this skill?
You need to find exceptions, inspect a trace, diagnose slow generations, or manage prompts and datasets in Langfuse.
What you get
A concrete root-cause hypothesis reached by moving from broad trace discovery to the exact failing observation.
- root-cause hypothesis
- trace and exception analysis
By the numbers
- requires Python 3.10 or newer
- 6 debugging playbooks
Files
Langfuse Skill
Debug AI agents and LLM applications through Langfuse observability.
This skill is the agent-facing companion to langfuse-mcp. It tells Claude Code and Codex when to use Langfuse, which MCP tool to call first, and how to move from broad trace discovery to a concrete root-cause hypothesis.
Triggers: langfuse, traces, debug AI, find exceptions, set up langfuse, what went wrong, why is it slow, datasets, evaluation sets
What This Skill Provides
- Setup steps for connecting
langfuse-mcpto Claude Code or Codex. - Playbooks for exception triage, trace inspection, latency analysis, sessions, prompts, and datasets.
- A quick reference for the highest-value MCP tools.
- Links to full setup and tool references for deeper troubleshooting.
Use the playbooks before guessing at individual tools. Start broad, identify the relevant trace/session/observation, then drill into the exact failure or slow path.
Setup
Step 1: Get credentials from https://cloud.langfuse.com → Settings → API Keys
If self-hosted, use your instance URL for LANGFUSE_HOST and create keys there.
Step 2: Install MCP (pick one):
Requires Python 3.10 or newer. CI verifies Python 3.10 through 3.14.
# Claude Code (project-scoped, shared via .mcp.json)
claude mcp add \
--scope project \
--env LANGFUSE_PUBLIC_KEY=pk-... \
--env LANGFUSE_SECRET_KEY=sk-... \
--env LANGFUSE_HOST=https://cloud.langfuse.com \
langfuse -- uvx langfuse-mcp
# Codex CLI (user-scoped, stored in ~/.codex/config.toml)
codex mcp add langfuse \
--env LANGFUSE_PUBLIC_KEY=pk-... \
--env LANGFUSE_SECRET_KEY=sk-... \
--env LANGFUSE_HOST=https://cloud.langfuse.com \
-- uvx langfuse-mcpAdd --python 3.14 before langfuse-mcp if you want to pin a CI-verified interpreter explicitly.
Step 3: Restart CLI, verify with /mcp (Claude) or codex mcp list (Codex)
Step 4: Test: fetch_traces(age=60)
Read-Only Mode
For safer observability without risk of modifying prompts or datasets, enable read-only mode:
# CLI flag
langfuse-mcp --read-only
# Or environment variable
LANGFUSE_MCP_READ_ONLY=trueThis disables write tools: create_text_prompt, create_chat_prompt, update_prompt_labels, create_dataset, create_dataset_item, delete_dataset_item.
Default Output Mode
If you want MCP clients to default to writing full payloads to files when they omit output_mode, configure:
langfuse-mcp --default-output-mode full_json_file
# Or via environment variable
LANGFUSE_MCP_DEFAULT_OUTPUT_MODE=full_json_fileFor manual .mcp.json setup or troubleshooting, see references/setup.md.
---
Playbooks
"Where are the errors?"
find_exceptions(age=1440, group_by="file")→ Shows error counts by file. Pick the worst offender.
find_exceptions_in_file(filepath="src/ai/chat.py", age=1440)→ Lists specific exceptions. Grab a trace_id.
get_exception_details(trace_id="...")→ Full stacktrace and context.
---
"What happened in this interaction?"
fetch_traces(age=60, user_id="...")→ Find the trace. Note the trace_id.
If you don't know the user_id, start with:
fetch_traces(age=60)fetch_trace(trace_id="...", include_observations=true)→ See all LLM calls in the trace.
fetch_observation(observation_id="...")→ Inspect a specific generation's input/output.
---
"Why is it slow?"
fetch_observations(age=60, type="GENERATION")→ Find recent LLM calls. Look for high latency.
fetch_observation(observation_id="...")→ Check token counts, model, timing.
---
"What's this user experiencing?"
get_user_sessions(user_id="...", age=1440)→ List their sessions.
get_session_details(session_id="...")→ See all traces in the session.
---
"Manage datasets"
list_datasets()→ See all datasets.
get_dataset(name="evaluation-set-v1")→ Get dataset details.
list_dataset_items(dataset_name="evaluation-set-v1", page=1, limit=10)→ Browse items in the dataset.
create_dataset(name="qa-test-cases", description="QA evaluation set")→ Create a new dataset.
create_dataset_item(
dataset_name="qa-test-cases",
input={"question": "What is 2+2?"},
expected_output={"answer": "4"}
)→ Add test cases.
create_dataset_item(
dataset_name="qa-test-cases",
item_id="item_123",
input={"question": "What is 3+3?"},
expected_output={"answer": "6"}
)→ Upsert: updates existing item by id or creates if missing.
---
"Manage prompts"
list_prompts()→ See all prompts with labels.
get_prompt(name="...", label="production")→ Fetch current production version.
create_text_prompt(name="...", prompt="...", labels=["staging"])→ Create new version in staging.
update_prompt_labels(name="...", version=N, labels=["production"])→ Promote to production. (Rollback = re-apply label to older version)
---
Quick Reference
| Task | Tool |
|---|---|
| List traces | fetch_traces(age=N) |
| Get trace details | fetch_trace(trace_id="...", include_observations=true) |
| List LLM calls | fetch_observations(age=N, type="GENERATION") |
| Get observation | fetch_observation(observation_id="...") |
| Error count | get_error_count(age=N) |
| Find exceptions | find_exceptions(age=N, group_by="file") |
| List sessions | fetch_sessions(age=N) |
| User sessions | get_user_sessions(user_id="...", age=N) |
| List prompts | list_prompts() |
| Get prompt | get_prompt(name="...", label="production") |
| List datasets | list_datasets() |
| Get dataset | get_dataset(name="...") |
| List dataset items | list_dataset_items(dataset_name="...", limit=N) |
| Create/update dataset item | create_dataset_item(dataset_name="...", item_id="...") |
age = minutes to look back (max 10080 = 7 days)
---
Troubleshooting
MCP connection fails
- Verify credentials: check
LANGFUSE_PUBLIC_KEY,LANGFUSE_SECRET_KEY,LANGFUSE_HOST - Restart CLI after adding/updating MCP config
- Test MCP independently:
fetch_traces(age=60)— if this fails, the issue is MCP, not the skill - See
references/setup.mdfor detailed troubleshooting
No traces found
- Increase the
ageparameter (default lookback may be too short) - Verify your application is sending traces to the correct Langfuse project
- Check
LANGFUSE_HOSTpoints to the right instance (cloud vs self-hosted)
Permission denied
- Regenerate API keys from Langfuse dashboard
- Ensure keys have the required scopes for the operation
- Write operations require read-write keys (not read-only mode)
---
References
references/tool-reference.md— Full parameter docs, filter semantics, response schemasreferences/setup.md— Manual setup, troubleshooting, advanced configuration
Langfuse MCP Setup Reference
Detailed setup instructions, troubleshooting, and configuration options.
Manual .mcp.json Setup
If you prefer manual configuration over claude mcp add:
{
"mcpServers": {
"langfuse": {
"command": "uvx",
"args": ["langfuse-mcp"],
"env": {
"LANGFUSE_PUBLIC_KEY": "pk-...",
"LANGFUSE_SECRET_KEY": "sk-...",
"LANGFUSE_HOST": "https://cloud.langfuse.com"
}
}
}
}Important: If .mcp.json already exists, merge the langfuse entry into the existing mcpServers object. Don't overwrite the file.
Add to .gitignore
grep -q '.mcp.json' .gitignore 2>/dev/null || echo '.mcp.json' >> .gitignoreNever commit credentials to version control.
---
Troubleshooting
Authentication Errors
- Public key must start with
pk- - Secret key must start with
sk- - Host must match your Langfuse instance (cloud vs self-hosted)
Python Version Errors
If MCP fails to connect, check your Python version. Langfuse MCP requires Python 3.10 or newer and CI currently verifies Python 3.10 through 3.14.
If your default interpreter is older than Python 3.10, pin a CI-verified Python in the uvx command:
uvx --python 3.14 langfuse-mcpOr verify manually:
uvx --python 3.14 langfuse-mcp --helpTimeout Errors
Increase the timeout:
# Claude Code with timeout
claude mcp add \
--scope project \
--env LANGFUSE_PUBLIC_KEY=pk-... \
--env LANGFUSE_SECRET_KEY=sk-... \
--env LANGFUSE_HOST=https://cloud.langfuse.com \
langfuse -- uvx langfuse-mcp --timeout 60
# Or in .mcp.json
"args": ["langfuse-mcp", "--timeout", "60"]Empty Results
- Check
ageparameter (minutes, not hours/days) - Verify filters match your data
- Try
fetch_traces(age=1440)with no filters to confirm data exists - Data older than 7 days (10080 minutes) cannot be retrieved
MCP Not Found
- Restart Claude Code / Codex CLI after adding MCP
- Run
/mcp(Claude) orcodex mcp list(Codex) to verify - Check
.mcp.jsonsyntax (valid JSON, correct paths) - Codex CLI uses
~/.codex/config.tomlfor config; verify that file instead of.mcp.json
---
Date-to-Minutes Conversion
| Time Range | Minutes |
|---|---|
| 1 hour | 60 |
| 6 hours | 360 |
| 12 hours | 720 |
| 1 day | 1440 |
| 2 days | 2880 |
| 3 days | 4320 |
| 7 days | 10080 (max) |
---
Glossary
| Term | Definition |
|---|---|
| Trace | Top-level container for a user interaction/request |
| Observation | Span, generation, or event inside a trace |
| Generation | LLM API call with input/output/tokens/latency |
| Span | Timed operation (function call, API request) |
| Event | Discrete log entry or exception |
| Session | Group of traces from the same user session |
---
Tool Groups
Load specific tool groups to reduce token overhead:
langfuse-mcp --tools traces,prompts| Group | Tools |
|---|---|
traces | fetch_traces, fetch_trace |
observations | fetch_observations, fetch_observation |
sessions | fetch_sessions, get_session_details, get_user_sessions |
exceptions | find_exceptions, find_exceptions_in_file, get_exception_details, get_error_count |
prompts | list_prompts, get_prompt, get_prompt_unresolved, create_text_prompt, create_chat_prompt, update_prompt_labels |
datasets | list_datasets, get_dataset, list_dataset_items, get_dataset_item, create_dataset, create_dataset_item, delete_dataset_item |
annotation_queues | list_annotation_queues, create_annotation_queue, get_annotation_queue, list_annotation_queue_items, get_annotation_queue_item, create_annotation_queue_item, update_annotation_queue_item, delete_annotation_queue_item, create_annotation_queue_assignment, delete_annotation_queue_assignment |
scores | list_scores_v2, get_score_v2 |
schema | get_data_schema |
---
Environment Variables
| Variable | Description |
|---|---|
LANGFUSE_PUBLIC_KEY | API public key (starts with pk-) |
LANGFUSE_SECRET_KEY | API secret key (starts with sk-) |
LANGFUSE_HOST | Langfuse instance URL |
LANGFUSE_TIMEOUT | API timeout in seconds (default: 30) |
LANGFUSE_MCP_TOOLS | Comma-separated tool groups to load |
LANGFUSE_MCP_LOG_FILE | Log file path (default: /tmp/langfuse_mcp.log) |
LANGFUSE_MCP_READ_ONLY | Set to true to disable write tools (safer observability mode) |
LANGFUSE_MCP_DEFAULT_OUTPUT_MODE | Default MCP tool output_mode (compact, full_json_string, full_json_file) |
---
Skill Installation Scopes
| Scope | Claude Code | Codex CLI |
|---|---|---|
| Project | .claude/skills/langfuse/ | .codex/skills/langfuse/ |
| User/Global | ~/.claude/skills/langfuse/ | ~/.codex/skills/langfuse/ |
Install globally:
cp -r skills/langfuse ~/.claude/skills/ # Claude Code
cp -r skills/langfuse ~/.codex/skills/ # Codex CLI---
Security Notes
- Never commit
.mcp.jsonwith real credentials - Rotate keys if leaked
full_json_fileexports may contain sensitive user data- Use environment variable injection in CI/CD rather than hardcoded values
Langfuse MCP Tool Reference
Reference documentation for the Langfuse MCP tools. The top-level README lists the current full tool inventory; this reference focuses on the most common debugging and management workflows.
Tools by Category
| Category | Tools |
|---|---|
| Traces | fetch_traces, fetch_trace |
| Observations | fetch_observations, fetch_observation |
| Sessions | fetch_sessions, get_session_details, get_user_sessions |
| Exceptions | find_exceptions, find_exceptions_in_file, get_exception_details, get_error_count |
| Prompts | list_prompts, get_prompt, get_prompt_unresolved, create_text_prompt, create_chat_prompt, update_prompt_labels* |
| Datasets | list_datasets, get_dataset, list_dataset_items, get_dataset_item, create_dataset, create_dataset_item, delete_dataset_item* |
| Annotation Queues | list_annotation_queues, create_annotation_queue, get_annotation_queue, list_annotation_queue_items, get_annotation_queue_item, create_annotation_queue_item, update_annotation_queue_item, delete_annotation_queue_item, create_annotation_queue_assignment, delete_annotation_queue_assignment |
| Scores | list_scores_v2, get_score_v2 |
| Schema | get_data_schema |
\Tools marked with \ are disabled in read-only mode (`--read-only` or `LANGFUSE_MCP_READ_ONLY=true`).
Output Modes
Some tools support output modes via the output_mode parameter:
| Mode | Description |
|---|---|
compact | Summary with large values truncated (default) |
full_json_string | Complete data as JSON string (returns string, not object) |
full_json_file | Save to file, return summary with path |
Tools with output_mode: fetch_traces, fetch_trace, fetch_observations, fetch_observation, fetch_sessions, get_session_details, get_user_sessions, find_exceptions_in_file, get_exception_details, list_dataset_items, get_dataset_item
Tools without output_mode: find_exceptions, get_error_count, list_prompts, get_prompt, get_prompt_unresolved, create_text_prompt, create_chat_prompt, update_prompt_labels, list_datasets, get_dataset, create_dataset, create_dataset_item, delete_dataset_item, get_data_schema
Filter Semantics
Filter behavior depends on the Langfuse API:
| Filter | Matching Rule |
|---|---|
name | Passed to Langfuse API (behavior varies by endpoint) |
tags | Comma-separated, passed to Langfuse API |
metadata | Exact key/value match, top-level keys only |
user_id, session_id, trace_id | Exact match |
Note: list_prompts uses exact name matching. Other tools pass filters to the Langfuse API.
Sort Order
Sort order depends on the Langfuse API. Traces and observations are typically sorted by timestamp descending (newest first).
Pagination
Some tools support pagination via page and limit parameters. Check individual tool docs.
Tools with pagination: fetch_traces, fetch_observations, fetch_sessions, list_prompts, list_datasets, list_dataset_items
Tools without pagination: find_exceptions, find_exceptions_in_file, get_exception_details, get_user_sessions
Tip: For large results, use output_mode="full_json_file" to avoid context overflow.
---
Traces
fetch_traces
Search and filter traces with pagination.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
age | int | Yes | - | Look back window in minutes from now (e.g., 1440 for 24h). Max 10080 (7 days). |
name | string | No | null | Name filter (passed to API) |
user_id | string | No | null | User ID to filter traces by (exact match) |
session_id | string | No | null | Session ID to filter traces by (exact match) |
metadata | object | No | null | Metadata fields to filter by (exact key/value match) |
tags | string | No | null | Tag or comma-separated list of tags |
page | int | No | 1 | Page number for pagination (starts at 1) |
limit | int | No | 50 | Maximum traces per page |
include_observations | bool | No | false | Include full observation objects instead of just IDs |
output_mode | string | No | "compact" | Output format |
Returns: List of trace objects with metadata including pagination info.
Example:
fetch_traces(age=1440, user_id="user_123", include_observations=true)---
fetch_trace
Fetch a specific trace by ID.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
trace_id | string | Yes | - | The ID of the trace to fetch |
include_observations | bool | No | false | Include full observation objects |
output_mode | string | No | "compact" | Output format |
Returns: Single trace object with all details.
Example:
fetch_trace(trace_id="abc-123", include_observations=true, output_mode="full_json_file")---
Observations
fetch_observations
Search and filter observations (spans, generations, events).
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
age | int | Yes | - | Look back window in minutes from now. Max 10080 (7 days). |
type | string | No | null | Filter by type: "SPAN", "GENERATION", or "EVENT" |
name | string | No | null | Name filter (passed to API) |
user_id | string | No | null | User ID filter (exact match) |
trace_id | string | No | null | Trace ID filter (exact match) |
parent_observation_id | string | No | null | Parent observation ID filter (exact match) |
page | int | No | 1 | Page number |
limit | int | No | 50 | Max items per page |
output_mode | string | No | "compact" | Output format |
Returns: List of observation objects.
Example:
fetch_observations(age=60, type="GENERATION", name="chat-completion")---
fetch_observation
Fetch a specific observation by ID.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
observation_id | string | Yes | - | The ID of the observation to fetch |
output_mode | string | No | "compact" | Output format |
Returns: Single observation object with full details.
---
Sessions
fetch_sessions
List recent sessions with pagination.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
age | int | Yes | - | Look back window in minutes from now. Max 10080 (7 days). |
page | int | No | 1 | Page number |
limit | int | No | 50 | Max items per page |
output_mode | string | No | "compact" | Output format |
Returns: List of session summaries.
---
get_session_details
Get detailed session info by ID.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
session_id | string | Yes | - | The session ID to fetch |
include_observations | bool | No | false | Include full observation objects instead of just IDs |
output_mode | string | No | "compact" | Output format |
Returns: Session object with all traces.
---
get_user_sessions
Get all sessions for a user.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
user_id | string | Yes | - | The user ID to look up |
age | int | Yes | - | Look back window in minutes from now. Max 10080 (7 days). |
include_observations | bool | No | false | Include full observation objects instead of just IDs |
output_mode | string | No | "compact" | Output format |
Returns: List of sessions for the user.
---
Exceptions
find_exceptions
Find exceptions grouped by file, function, or type.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
age | int | Yes | - | Look back window in minutes from now. Max 10080 (7 days). |
group_by | string | No | "file" | How to group: "file", "function", or "type" |
Returns: List of {group: string, count: int} objects, sorted by count descending (top 50).
Note: Does not support output_mode parameter.
Example:
find_exceptions(age=1440, group_by="type")---
find_exceptions_in_file
Find exceptions in a specific file.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
filepath | string | Yes | - | Path to the file as recorded in Langfuse metadata (typically relative to project root, e.g., src/utils/ai.ts) |
age | int | Yes | - | Look back window in minutes from now. Max 10080 (7 days). |
output_mode | string | No | "compact" | Output format |
Returns: List of exception details (top 10, newest first):
observation_id,trace_id,timestampexception_type,exception_message,exception_stacktracefunction,line_number
Example:
find_exceptions_in_file(filepath="src/ai/chat.py", age=1440)---
get_exception_details
Get detailed exception info for a trace/span.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
trace_id | string | Yes | - | The trace ID to analyze |
span_id | string | No | null | Optional span ID to filter by |
output_mode | string | No | "compact" | Output format |
Returns: List of exceptions with full context including observation details.
---
get_error_count
Get total error count.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
age | int | Yes | - | Look back window in minutes from now. Max 10080 (7 days). |
Returns:
{
"data": {
"age_minutes": 60,
"from_timestamp": "2024-01-15T09:30:00Z",
"to_timestamp": "2024-01-15T10:30:00Z",
"trace_count": 5,
"observation_count": 12,
"exception_count": 18
},
"metadata": {...}
}Note: Does not support output_mode parameter.
---
Prompts
list_prompts
List and filter prompts in the project.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | No | null | Filter by exact prompt name |
label | string | No | null | Filter by label (e.g., "production") |
tag | string | No | null | Filter by tag |
page | int | No | 1 | Page number |
limit | int | No | 50 | Max items per page (max 100) |
Returns: List of prompt metadata:
name,type("text" or "chat")versions,labels,tagslastUpdatedAt,lastConfig
---
get_prompt
Fetch a specific prompt with resolved dependencies.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | The prompt name |
label | string | No | null | Label to fetch (e.g., "production"). Mutually exclusive with version. |
version | int | No | null | Specific version number. Mutually exclusive with label. |
Returns: Prompt object:
id,name,version,typeprompt(string for text, list for chat)labels,tags,config
Example:
get_prompt(name="chat-system", label="production")---
get_prompt_unresolved
Fetch a prompt WITHOUT resolving dependencies.
Returns raw prompt content with dependency tags intact (e.g., @@@langfusePrompt:name=xxx@@@) when the SDK supports resolve=false. If the SDK doesn't support this parameter, returns the resolved prompt and sets metadata.resolved=true to indicate fallback behavior.
Parameters: Same as get_prompt.
Returns: Same structure but with dependency tags preserved in prompt content. Check metadata.resolved to verify if unresolved content was returned.
---
create_text_prompt
Create a new text prompt version.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | The prompt name |
prompt | string | Yes | - | Prompt text content (supports {{variables}}) |
labels | list[string] | No | null | Labels to assign (e.g., ["staging"]) |
config | object | No | null | Model config (see example below) |
tags | list[string] | No | null | Tags for organization |
commit_message | string | No | null | Commit message describing changes |
Config Example:
{
"model": "gpt-4",
"temperature": 0.7,
"max_tokens": 1000,
"top_p": 1.0
}Returns: Created prompt object.
Note: Prompts are immutable. Creating a new version is the only way to update content. Labels are unique across versions - assigning a label here removes it from other versions.
Example:
create_text_prompt(
name="greeting",
prompt="Hello {{name}}, welcome to {{app}}!",
labels=["staging"],
config={"model": "gpt-4", "temperature": 0.7},
commit_message="feat: add personalized greeting"
)---
create_chat_prompt
Create a new chat prompt version.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | The prompt name |
prompt | list[object] | Yes | - | Chat messages (see format below) |
labels | list[string] | No | null | Labels to assign |
config | object | No | null | Model config (same as create_text_prompt) |
tags | list[string] | No | null | Tags for organization |
commit_message | string | No | null | Commit message |
Prompt Format:
[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "{{user_input}}"}
]Returns: Created prompt object.
Example:
create_chat_prompt(
name="assistant",
prompt=[
{"role": "system", "content": "You are a helpful coding assistant."},
{"role": "user", "content": "{{question}}"}
],
labels=["staging"],
config={"model": "gpt-4", "temperature": 0.3}
)---
update_prompt_labels
Update labels for a specific prompt version.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | The prompt name |
version | int | Yes | - | The version to update |
labels | list[string] | Yes | - | Labels to add (existing labels preserved) |
Returns: Updated prompt object.
Note: This is the only supported mutation for existing prompts. Labels are unique across versions - adding a label here removes it from other versions.
Example (promote to production):
update_prompt_labels(name="greeting", version=3, labels=["production"])Example (rollback):
update_prompt_labels(name="greeting", version=2, labels=["production"])---
Datasets
list_datasets
List all datasets with pagination.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
page | int | No | 1 | Page number |
limit | int | No | 50 | Max items per page |
Returns: List of dataset objects with metadata.
Example:
list_datasets(page=1, limit=20)---
get_dataset
Get a dataset by name.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | The name of the dataset to fetch |
Returns: Dataset object with full details.
Example:
get_dataset(name="evaluation-set-v1")---
list_dataset_items
List items in a dataset with optional filters.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
dataset_name | string | Yes | - | The name of the dataset |
source_trace_id | string | No | null | Filter by source trace ID |
source_observation_id | string | No | null | Filter by source observation ID |
page | int | No | 1 | Page number |
limit | int | No | 50 | Max items per page |
output_mode | string | No | "compact" | Output format |
Returns: List of dataset items.
Example:
list_dataset_items(dataset_name="evaluation-set-v1", page=1, limit=10)---
get_dataset_item
Get a specific dataset item by ID.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
item_id | string | Yes | - | The ID of the dataset item to fetch |
output_mode | string | No | "compact" | Output format |
Returns: Dataset item object with full details.
Example:
get_dataset_item(item_id="item-abc-123")---
create_dataset
Create a new dataset.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | The name for the new dataset |
description | string | No | null | Description of the dataset |
metadata | object | No | null | Additional metadata |
Returns: Created dataset object.
Example:
create_dataset(name="qa-evaluation-set", description="QA test cases for v2.0")---
create_dataset_item
Create or upsert a dataset item.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
dataset_name | string | Yes | - | The name of the dataset |
input | any | No | null | Input data for the item |
expected_output | any | No | null | Expected output for evaluation |
metadata | object | No | null | Additional metadata |
source_trace_id | string | No | null | Link to source trace |
source_observation_id | string | No | null | Link to source observation |
item_id | string | No | null | Item ID (for upsert; if exists, updates the item) |
status | string | No | null | Item status (e.g., "ACTIVE", "ARCHIVED") |
Returns: Created or updated dataset item object.
Example:
create_dataset_item(
dataset_name="qa-evaluation-set",
input={"question": "What is the capital of France?"},
expected_output={"answer": "Paris"},
metadata={"category": "geography"}
)---
delete_dataset_item
Delete a dataset item.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
item_id | string | Yes | - | The ID of the dataset item to delete |
Returns: Confirmation of deletion.
Example:
delete_dataset_item(item_id="item-abc-123")---
Schema
get_data_schema
Get schema information for response structures.
Parameters: None (dummy parameter for compatibility).
Returns: Documentation of response schemas for all tools.
---
Response Format
Tools return responses in one of two formats depending on output_mode:
For compact and full_json_file modes:
{
"data": [...] | {...},
"metadata": {
"item_count": 10,
"page": 1,
"total": 100,
"next_page": 2,
"file_path": "/tmp/langfuse_mcp/traces_2024...json",
"file_info": {...}
}
}For full_json_string mode:
Returns a string containing serialized JSON (not an object). Parse it if you need structured access.
---
Example Response (compact)
{
"data": [
{
"id": "trace-abc-123",
"name": "chat-completion",
"user_id": "user-456",
"timestamp": "2024-01-15T10:30:00Z",
"observations": ["obs-1", "obs-2"]
}
],
"metadata": {
"item_count": 1,
"page": 1,
"total": 47,
"next_page": 2,
"file_path": null,
"file_info": null
}
}Example Response (full_json_file)
{
"data": [{"id": "trace-abc-123", "...": "truncated"}],
"metadata": {
"item_count": 1,
"page": 1,
"total": 47,
"file_path": "/tmp/langfuse_mcp/traces_20240115_103000.json",
"file_info": {
"size_bytes": 15234,
"created_at": "2024-01-15T10:30:05Z"
}
}
}Related skills
FAQ
How do I connect Langfuse to Claude Code?
Run claude mcp add with LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, and LANGFUSE_HOST env vars pointing at uvx langfuse-mcp.
Can I use it without risking writes?
Yes. Read-only mode via --read-only or LANGFUSE_MCP_READ_ONLY=true disables write tools like create_text_prompt and create_dataset.