Langfuse MCP

v0.14.0
io.github.avivsinai/langfuse-mcp Checked 14 hours ago Published 1 month ago

Langfuse MCP server for accessing and analyzing telemetry data via natural language

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_annotation_queues

List annotation queues with pagination.

ParameterTypeDescription
limitintegerItems per page (max 100)
pageintegerPage number for pagination (starts at 1)

create_annotation_queue

Create an annotation queue.

ParameterTypeDescription
name *stringUnique queue name
descriptionOptional queue description
score_config_idsOptional score config IDs attached to this queue

get_annotation_queue

Get a single annotation queue by ID.

ParameterTypeDescription
queue_id *stringAnnotation queue ID

list_annotation_queue_items

List items in an annotation queue.

ParameterTypeDescription
queue_id *stringAnnotation queue ID
limitintegerItems per page (max 100)
pageintegerPage number for pagination (starts at 1)

get_annotation_queue_item

Get a specific annotation queue item by queue and item ID.

ParameterTypeDescription
item_id *stringAnnotation queue item ID
queue_id *stringAnnotation queue ID

create_annotation_queue_item

Create an annotation queue item.

ParameterTypeDescription
object_id *stringObject ID to enqueue
object_type *stringObject type, for example TRACE or OBSERVATION
queue_id *stringAnnotation queue ID
statusOptional status

update_annotation_queue_item

Update the status of an annotation queue item.

ParameterTypeDescription
item_id *stringAnnotation queue item ID
queue_id *stringAnnotation queue ID
status *stringNew status value

delete_annotation_queue_item

Delete an annotation queue item.

ParameterTypeDescription
item_id *stringAnnotation queue item ID
queue_id *stringAnnotation queue ID

create_annotation_queue_assignment

Assign a user to an annotation queue.

ParameterTypeDescription
queue_id *stringAnnotation queue ID
user_id *stringUser ID to assign

delete_annotation_queue_assignment

Unassign a user from an annotation queue.

ParameterTypeDescription
queue_id *stringAnnotation queue ID
user_id *stringUser ID to unassign

list_datasets

List all datasets in the project with pagination. Returns metadata about datasets including name, description, item count, and timestamps. Args: ctx: Context object containing lifespan context with Langfuse client page: Page number for pagination (starts at 1) limit: Maximum items per page (max 100) Returns: A dictionary containing: - data: List of dataset metadata objects - metadata: Pagination info (page, limit, total)

ParameterTypeDescription
limitintegerItems per page (max 100)
pageintegerPage number for pagination (starts at 1)

get_dataset

Get a specific dataset by name. Retrieves dataset details including metadata and item count. Args: ctx: Context object containing lifespan context with Langfuse client name: The name of the dataset to fetch Returns: A dictionary containing dataset details: - id: Unique dataset identifier - name: Dataset name - description: Dataset description - metadata: Custom metadata - items: List of dataset items (if included by the API) - runs: List of dataset runs (if included by the API)

ParameterTypeDescription
name *stringThe name of the dataset to fetch

list_dataset_items

List items in a dataset with pagination and optional filtering. Returns dataset items with their input, expected output, and metadata. Args: ctx: Context object containing lifespan context with Langfuse client dataset_name: The name of the dataset to list items from source_trace_id: Optional filter by source trace ID source_observation_id: Optional filter by source observation ID page: Page number for pagination (starts at 1) limit: Maximum items per page (max 100) output_mode: How to format the response data Returns:…

ParameterTypeDescription
dataset_name *stringThe name of the dataset to list items from
limitintegerItems per page (max 100)
output_modestringOutput format: 'compact' truncates, 'full_json_string' returns full data, 'full_json_file' writes to file
pageintegerPage number for pagination (starts at 1)
source_observation_idFilter by source observation ID
source_trace_idFilter by source trace ID

get_dataset_item

Get a specific dataset item by ID. Retrieves the full dataset item including input, expected output, metadata, and linked traces. Args: ctx: Context object containing lifespan context with Langfuse client item_id: The ID of the dataset item to fetch output_mode: How to format the response data Returns: A dictionary containing the dataset item details: - id: Unique item identifier - datasetId: Parent dataset ID - input: Input data for the item - expectedOutput: Expected output data - metadata: Custom metadata…

ParameterTypeDescription
item_id *stringThe ID of the dataset item to fetch
output_modestringOutput format: 'compact' truncates, 'full_json_string' returns full data, 'full_json_file' writes to file

create_dataset

Create a new dataset in the project. Datasets are used to store evaluation test cases with input/expected output pairs. Args: ctx: Context object containing lifespan context with Langfuse client name: Name for the new dataset (must be unique) description: Optional description metadata: Optional custom metadata Returns: A dictionary containing the created dataset details: - id: Unique dataset identifier - name: Dataset name - description: Dataset description - metadata: Custom metadata - createdAt: Cr…

ParameterTypeDescription
name *stringName for the new dataset (must be unique in project)
descriptionOptional description of the dataset
metadataOptional custom metadata as key-value pairs

create_dataset_item

Create a new item in a dataset, or update if item_id already exists. Dataset items store input/expected output pairs for evaluation. If item_id is provided and already exists, the item will be updated (upsert behavior). Args: ctx: Context object containing lifespan context with Langfuse client dataset_name: Name of the target dataset input: Input data for the item expected_output: Expected output for evaluation metadata: Optional custom metadata source_trace_id: Optional linked trace ID source_observation_id: Optional linked…

ParameterTypeDescription
dataset_name *stringName of the dataset to add the item to
expected_outputExpected output data for evaluation (any JSON-serializable value)
inputInput data for the dataset item (any JSON-serializable value)
item_idOptional custom ID for the item (for upsert behavior)
metadataOptional custom metadata as key-value pairs
source_observation_idOptional observation ID to link this item to
source_trace_idOptional trace ID to link this item to
statusItem status (default: ACTIVE)

delete_dataset_item

Delete a dataset item by ID. This is a permanent deletion and cannot be undone. Args: ctx: Context object containing lifespan context with Langfuse client item_id: The ID of the dataset item to delete Returns: A dictionary confirming the deletion

ParameterTypeDescription
item_id *stringThe ID of the dataset item to delete

list_dataset_runs

List runs for a dataset by dataset name.

ParameterTypeDescription
dataset_name *stringThe name of the dataset to list runs from
limitintegerItems per page (max 100)
pageintegerPage number for pagination (starts at 1)

get_dataset_run

Get a dataset run, including any run items returned by the SDK.

ParameterTypeDescription
dataset_name *stringThe name of the dataset that owns the run
run_name *stringThe dataset run name to fetch
output_modestringOutput format: 'compact' truncates, 'full_json_string' returns full data, 'full_json_file' writes to file

list_dataset_run_items

List dataset run items by dataset ID and run name.

ParameterTypeDescription
dataset_id *stringDataset ID that owns the run items
run_name *stringDataset run name to list items from
limitintegerItems per page (max 100)
output_modestringOutput format: 'compact' truncates, 'full_json_string' returns full data, 'full_json_file' writes to file
pageintegerPage number for pagination (starts at 1)

create_dataset_run_item

Create a dataset run item and flush the ingestion write. If this legacy API is gone, use the SDK experiment runner or OTel ingestion; neither can link an existing trace through this API.

ParameterTypeDescription
dataset_item_id *stringDataset item ID to include in the run
run_name *stringDataset run name to append this item to
metadataOptional run-item metadata
observation_idOptional observation ID linked to this run item
run_descriptionOptional run description
trace_idOptional trace ID linked to this run item

delete_dataset_run

Delete a run through the legacy route, or explicitly delete its traces after removal. Trace deletion also removes observations and related scores. Set delete_traces=True to allow this broader replacement.

ParameterTypeDescription
dataset_name *stringThe name of the dataset that owns the run
run_name *stringThe dataset run name to delete
delete_tracesbooleanAllow trace deletion when the legacy run-delete route is unavailable

find_exceptions

Get error-level observations grouped by file path, function, type, name, or observation type. Args: ctx: Context object containing lifespan context with Langfuse client age: Number of minutes to look back; capped by the configured maximum group_by: How to group errors - "file" groups by recorded code.filepath, "function" by code.function, "type" by recorded exception.type, "name" by observation name, or "observation_type" by observation type Returns: List of error-observation counts grouped by the specified category.…

ParameterTypeDescription
age *integerNumber of minutes to look back (positive integer, max 7 days/10080 minutes)
group_bystringHow to group errors - 'file' groups by recorded code.filepath metadata, 'function' by code.function, 'type' by recorded exception.type, 'name' by observation name, or 'observation_type' by observation…

find_exceptions_in_file

Get detailed error info for a specific file (recorded code.filepath match). Args: ctx: Context object containing lifespan context with Langfuse client filepath: Path to the file as recorded in Langfuse metadata (code.filepath) age: Number of minutes to look back; capped by the configured maximum output_mode: Controls the output format and detail level Returns: Based on output_mode: - compact: List of summarized error records (top 10 newest after the full scan) - full_json_string: String containing the full JSON response…

ParameterTypeDescription
age *integerNumber of minutes to look back (positive integer, max 7 days/10080 minutes)
filepath *stringPath to the file to search for exceptions (full path including extension)
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…

get_exception_details

Get detailed error info for a trace/observation. Args: ctx: Context object containing lifespan context with Langfuse client trace_id: The ID of the trace to analyze for errors (unique identifier string) span_id: Optional observation ID to filter by (applies across all observation types) output_mode: Controls the output format and detail level Returns: Based on output_mode: - compact: List of summarized error records - full_json_string: String containing the full JSON response - full_json_file: List of summarized error re…

ParameterTypeDescription
trace_id *stringThe ID of the trace to analyze for exceptions (unique identifier string)
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…
span_idOptional span ID to filter by specific span (unique identifier string)

get_error_count

Get number of traces with error-level observations in last N minutes. Args: ctx: Context object containing lifespan context with Langfuse client age: Number of minutes to look back; capped by the configured maximum Returns: Dictionary with error statistics: trace_count (distinct traces), observation_count (error-level observations), and exception_count (the same error-observation total as find_exceptions, not a count of individual exception events; see metadata.note).

ParameterTypeDescription
age *integerNumber of minutes to look back (positive integer, max 7 days/10080 minutes)

query_metrics

Query aggregated metrics (cost, latency, token usage, counts, score values) from Langfuse. Wraps the Langfuse v2 metrics endpoint. Use this for analytics questions — "what did inference cost in the last 24h grouped by model", "p95 latency per prompt", "score distribution by name" — instead of pulling raw observations and aggregating client-side. Per-parameter contracts live in the Field descriptions above. Notes: - The v2 metrics endpoint is Langfuse Cloud-only; self-hosted instances may return 404. - Recently-ingested data can lag (OTEL ingestion dela…

ParameterTypeDescription
metrics *arrayOne or more metrics to compute. Each item is {'measure': <name>, 'aggregation': <fn>}, e.g. [{'measure': 'totalCost', 'aggregation': 'sum'}, {'measure': 'latency', 'aggregation': 'p95'}]. Aggregations…
view *stringData view to aggregate over: 'observations' (spans/generations/events — latency, cost, tokens, counts), 'scores-numeric' (numeric/boolean scores), or 'scores-categorical' (categorical scores). Call…
ageMinutes to look back from now (e.g. 1440 for 24h). Used when from_timestamp is omitted; defaults to 1440 (24h) when no time range is given.
dimensionsOptional fields to group results by, e.g. ['providedModelName']. Do NOT use high-cardinality fields (id, traceId, userId, sessionId) as dimensions — pass them as filters instead.
filtersOptional filter objects: {'column','operator','value','type', plus 'key' for metadata/object types}. Example: [{'column':'userId','operator':'=','value':'u1','type':'string'}]. See get_metrics_schema…
from_timestampISO-8601 start of the time range. Overrides 'age' when provided.
order_byOptional ordering: list of {'field': <dimension-or-metric>, 'direction': 'asc'|'desc'}.
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…
time_granularityWhen set, results are bucketed by this granularity across the time range (time series).
to_timestampISO-8601 end of the time range. Defaults to now (UTC).

get_metrics_schema

Get the query schema for the metrics API (views, dimensions, measures, aggregations). Companion to query_metrics: describes which views exist, the dimensions and measures available on each, the supported aggregations/operators, and the query-object shape. ``dummy`` is unused and exists only for MCP API compatibility.

ParameterTypeDescription
dummystring

fetch_observations

Get observations filtered by type and other criteria. Args: ctx: Context object containing lifespan context with Langfuse client type: The observation type to filter by (SPAN, GENERATION, EVENT, AGENT, TOOL, CHAIN, RETRIEVER, EVALUATOR, EMBEDDING or GUARDRAIL) age: Minutes ago to start looking (e.g., 1440 for 24 hours) name: Optional name filter (string pattern to match) user_id: Optional user ID filter (exact match) trace_id: Optional trace ID filter (exact match) parent_observation_id: Optional parent observation ID filter (exact m…

ParameterTypeDescription
age *integerMinutes ago to start looking (e.g., 1440 for 24 hours)
limitintegerMaximum number of observations to return per page
nameOptional name filter (string pattern to match)
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…
pageintegerPage number for pagination (starts at 1)
parent_observation_idOptional parent observation ID filter (exact match)
trace_idOptional trace ID filter (exact match)
typeThe observation type to filter by (SPAN, GENERATION, EVENT, AGENT, TOOL, CHAIN, RETRIEVER, EVALUATOR, EMBEDDING or GUARDRAIL)
user_idOptional user ID filter (exact match)

fetch_observation

Get a single observation by ID. Args: ctx: Context object containing lifespan context with Langfuse client observation_id: The ID of the observation to fetch (unique identifier string) output_mode: Controls the output format and detail level Returns: Based on output_mode: - compact: Summarized observation object - full_json_string: String containing the full JSON response - full_json_file: Summarized observation object with file save info

ParameterTypeDescription
observation_id *stringThe ID of the observation to fetch (unique identifier string)
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…

get_prompt

Fetch a specific prompt by name with resolved dependencies. Retrieves a prompt from Langfuse with all dependency tags resolved. Uses the SDK's built-in caching for optimal performance. Args: ctx: Context object containing lifespan context with Langfuse client name: The name of the prompt to fetch label: Optional label to fetch (e.g., 'production'). Cannot be used with version. version: Optional specific version number. Cannot be used with label. Returns: A dictionary containing the prompt details: - id: Unique prompt identifier…

ParameterTypeDescription
name *stringThe name of the prompt to fetch
labelLabel to fetch (e.g., 'production', 'staging'). Mutually exclusive with version.
versionSpecific version number to fetch. Mutually exclusive with label.

get_prompt_unresolved

Fetch a specific prompt by name WITHOUT resolving dependencies. Returns raw prompt content with dependency tags intact (e.g., @@@langfusePrompt:name=xxx@@@) when the SDK supports resolve=false. Otherwise returns the resolved prompt and marks metadata.resolved=True. Useful for analyzing prompt composition and debugging dependency chains. Args: ctx: Context object containing lifespan context with Langfuse client name: The name of the prompt to fetch label: Optional label to fetch. Cannot be used with version. version: Optional specific version nu…

ParameterTypeDescription
name *stringThe name of the prompt to fetch
labelLabel to fetch (e.g., 'production', 'staging'). Mutually exclusive with version.
versionSpecific version number to fetch. Mutually exclusive with label.

list_prompts

List and filter prompts in the project. Returns metadata about prompts including versions, labels, tags, and last updated time. Args: ctx: Context object containing lifespan context with Langfuse client name: Optional filter by exact prompt name label: Optional filter by label on any version tag: Optional filter by tag page: Page number for pagination (starts at 1) limit: Maximum items per page (max 100) Returns: A dictionary containing: - data: List of prompt metadata objects - metadata: Pagination info (pa…

ParameterTypeDescription
labelFilter by label (e.g., 'production', 'staging')
limitintegerItems per page (max 100)
nameFilter by exact prompt name
pageintegerPage number for pagination (starts at 1)
tagFilter by tag

create_text_prompt

Create a new text prompt version in Langfuse. Prompts are immutable; creating a new version is the only way to update prompt content. Labels are unique across versions - assigning a label here will move it from other versions.

ParameterTypeDescription
name *stringThe name of the prompt to create
prompt *stringPrompt text content (supports {{variables}})
commit_messageOptional commit message describing the changes
configOptional JSON config (e.g., {model: 'gpt-4', temperature: 0.7})
labelsLabels to assign (e.g., ['production', 'staging'])
tagsOptional tags for organization (e.g., ['experimental', 'v2'])

create_chat_prompt

Create a new chat prompt version in Langfuse. Chat prompts are arrays of role/content messages. Prompts are immutable; create a new version to update content. Labels are unique across versions.

ParameterTypeDescription
name *stringThe name of the prompt to create
prompt *arrayChat messages in the format [{role: 'system'|'user'|'assistant', content: '...'}]
commit_messageOptional commit message describing the changes
configOptional JSON config (e.g., {model: 'gpt-4', temperature: 0.7})
labelsLabels to assign (e.g., ['production', 'staging'])
tagsOptional tags for organization (e.g., ['experimental', 'v2'])

update_prompt_labels

Update labels for a specific prompt version. This is the only supported mutation for existing prompts. Provided labels are added to the version (existing labels are preserved). Labels are unique across versions, and the 'latest' label is managed by Langfuse.

ParameterTypeDescription
labels *arrayLabels to add to this version (can be empty to add none). Existing labels are preserved; labels are unique across versions.
name *stringThe name of the prompt to update
version *integerThe prompt version to update

find_route_decisions

Find generic agent route decisions emitted as Langfuse SPAN observations. This tool is router-neutral. It only treats observations with metadata.schema_version == "mcp.route_decision.v1" as route decisions, and it filters on fields inside observation metadata rather than display output.

ParameterTypeDescription
ageintegerNumber of minutes to look back (positive integer, max 7 days/10080 minutes)
capability_idOptional route-decision metadata capability_id filter
decision_idOptional route-decision metadata decision_id filter
limitintegerMaximum number of route decisions to return per page
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…
pageintegerPage number for pagination (starts at 1)
providerOptional route-decision metadata provider filter
router_nameOptional route-decision metadata router_name filter
session_idOptional route-decision metadata session_id filter
trace_idOptional Langfuse trace ID filter

get_route_decision

Fetch one route decision by metadata decision_id.

ParameterTypeDescription
decision_id *stringRoute-decision metadata decision_id to fetch
ageintegerNumber of minutes to look back (positive integer, max 7 days/10080 minutes)
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…

summarize_route_decisions

Summarize generic route decisions for a trace, session, router, provider, or capability.

ParameterTypeDescription
ageintegerNumber of minutes to look back (positive integer, max 7 days/10080 minutes)
capability_idOptional route-decision metadata capability_id filter
limitintegerMaximum number of route decisions to summarize from the current page
max_confidencenumberConfidence threshold used for low-confidence counts
pageintegerPage number for pagination (starts at 1)
providerOptional route-decision metadata provider filter
router_nameOptional route-decision metadata router_name filter
session_idOptional route-decision metadata session_id filter
trace_idOptional Langfuse trace ID filter

find_low_confidence_route_decisions

Find route decisions that are low-confidence or explicitly uncallable.

ParameterTypeDescription
ageintegerNumber of minutes to look back (positive integer, max 7 days/10080 minutes)
capability_idOptional route-decision metadata capability_id filter
include_uncallablebooleanAlso return decisions with metadata callable=false
limitintegerMaximum number of matching route decisions to return
max_confidencenumberReturn route decisions with confidence at or below this value
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…
pageintegerPage number for pagination (starts at 1)
providerOptional route-decision metadata provider filter
router_nameOptional route-decision metadata router_name filter
session_idOptional route-decision metadata session_id filter
trace_idOptional Langfuse trace ID filter

get_data_schema

Get schema of trace, span and event objects. Args: ctx: Context object containing lifespan context with Langfuse client dummy: Unused parameter for API compatibility (can be left empty) Returns: String containing the detailed schema definitions for traces, spans, events, and other core Langfuse data structures

ParameterTypeDescription
dummystring

list_scores_v2

List scores via Scores API v3 with optional filters (GET /v2/scores where v3 is not served). With operator ``=`` and a value, v3 defaults an omitted data_type to NUMERIC; pass BOOLEAN for boolean scores. Strict ``>``/``<`` can return fewer than limit rows on a page after boundary rows are dropped; next_page shows whether more rows exist.

ParameterTypeDescription
config_idOptional score config ID
data_typeOptional score data type
environmentOptional environment filter
from_timestampOptional ISO8601 timestamp lower bound
limitintegerItems per page (max 100)
nameOptional score name filter
operatorOptional comparison for value: =, >, >=, < or <= (default =)
pageintegerPage number for pagination (starts at 1)
queue_idOptional annotation queue ID
score_idsOptional comma-separated score IDs
session_idOptional session ID (not together with trace_id)
sourceOptional score source filter
to_timestampOptional ISO8601 timestamp upper bound
trace_idOptional trace ID
trace_tagsOptional comma-separated trace tags (Scores API v3 has none: uses GET /v2/scores, which Langfuse Cloud removes on 2026-11-16)
user_idOptional user ID filter (Scores API v3 has none: uses GET /v2/scores, which Langfuse Cloud removes on 2026-11-16)
valueOptional numeric score value filter

get_score_v2

Get a score by ID from Scores API v3 (the v2 route where v3 is not served).

ParameterTypeDescription
score_id *stringScore ID

fetch_sessions

Get a list of sessions in the current project. Args: ctx: Context object containing lifespan context with Langfuse client age: Minutes ago to start looking (e.g., 1440 for 24 hours) page: Page number for pagination (starts at 1) limit: Maximum number of sessions to return per page output_mode: Controls the output format and detail level Returns: Based on output_mode: - compact: List of summarized session objects - full_json_string: String containing the full JSON response - full_json_file: List of summarized sess…

ParameterTypeDescription
age *integerMinutes ago to start looking (e.g., 1440 for 24 hours)
limitintegerMaximum number of sessions to return per page
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…
pageintegerPage number for pagination (starts at 1)

get_session_details

Get detailed information about a specific session. Args: ctx: Context object containing lifespan context with Langfuse client session_id: The ID of the session to retrieve (unique identifier string) include_observations: If True, fetch and include the full observation objects instead of just IDs. Use this when you need access to system prompts, model parameters, or other details stored within observations. Significantly increases response time but provides complete data. output_mode: Controls the output format and detail level R…

ParameterTypeDescription
session_id *stringThe ID of the session to retrieve (unique identifier string)
include_observationsbooleanIf True, fetch and include the full observation objects instead of just IDs. Use this when you need access to system prompts, model parameters, or other details stored within observations. Significant…
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…

get_user_sessions

Get sessions for a user within a time range. Args: ctx: Context object containing lifespan context with Langfuse client user_id: The ID of the user to retrieve sessions for (unique identifier string) age: Minutes ago to start looking (e.g., 1440 for 24 hours) include_observations: If True, fetch and include the full observation objects instead of just IDs. Use this when you need access to system prompts, model parameters, or other details stored within observations. Significantly increases response time but provides complete data.…

ParameterTypeDescription
age *integerMinutes ago to start looking (e.g., 1440 for 24 hours)
user_id *stringThe ID of the user to retrieve sessions for
include_observationsbooleanIf True, fetch and include the full observation objects instead of just IDs. Use this when you need access to system prompts, model parameters, or other details stored within observations. Significant…
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…

fetch_traces

Find traces based on filters. All filter parameters are optional. On Observations API v2, each trace is built from its root observation; traces without a root observation do not appear.

ParameterTypeDescription
age *integerMinutes ago to start looking (e.g., 1440 for 24 hours)
include_observationsbooleanIf True, fetch and include the full observation objects instead of just IDs. Use this when you need access to system prompts, model parameters, or other details stored within observations. Significant…
limitintegerMaximum number of traces to return per page
metadataMetadata fields to filter by
nameName of the trace to filter by
output_modestringControls the output format: 'compact' (default) returns summarized JSON, 'full_json_string' returns complete raw JSON as string, 'full_json_file' saves complete data to file and returns summary with p…
pageintegerPage number for pagination (starts at 1)
session_idSession ID to filter traces by
tagsTag or comma-separated list of tags to filter traces by
user_idUser ID to filter traces by

fetch_trace

Get a single trace by ID with full details. On Observations API v2, a trace is built from its root observation; a trace with no observations is not found. Args: ctx: Context object containing lifespan context with Langfuse client trace_id: The ID of the trace to fetch (unique identifier string) include_observations: If True, fetch and include the full observation objects. If False, the observations field group is dropped entirely to avoid expensive per-observation IO. Use True when you need access to system prompts, model parameters, or…

ParameterTypeDescription
trace_id *stringThe ID of the trace to fetch (unique identifier string)
include_observationsbooleanIf True, fetch and include the full observation objects. If False, the observations field group is dropped entirely to avoid the expensive per-observation IO that dominates large-trace payloads. Use T…
output_modestringControls the output format and action. 'compact' (default): Returns a summarized JSON object optimized for direct agent consumption. 'full_json_string': Returns the complete, raw JSON data serialized…