Skip to main content
Glama
avivsinai

langfuse-mcp

by avivsinai

fetch_observations

Retrieve and filter Langfuse observations by type, age, name, user, trace, or parent ID to debug and analyze LLM application activity.

Instructions

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 match)
    page: Page number for pagination (starts at 1)
    limit: Maximum number of observations to return per page
    output_mode: Controls the output format and detail level

Returns:
    Based on output_mode:
    - compact: List of summarized observation objects
    - full_json_string: String containing the full JSON response
    - full_json_file: List of summarized observation objects with file save info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ageYesMinutes ago to start looking (e.g., 1440 for 24 hours)
nameNoOptional name filter (string pattern to match)
pageNoPage number for pagination (starts at 1)
typeNoThe observation type to filter by (SPAN, GENERATION, EVENT, AGENT, TOOL, CHAIN, RETRIEVER, EVALUATOR, EMBEDDING or GUARDRAIL)
limitNoMaximum number of observations to return per page
user_idNoOptional user ID filter (exact match)
trace_idNoOptional trace ID filter (exact match)
output_modeNoControls 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 as a string. 'full_json_file': Returns a summarized JSON object AND saves the complete data to a file.compact
parent_observation_idNoOptional parent observation ID filter (exact match)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.11.0
    • changedInput schema / properties / type / anyOf
      Previous value: -[
      -  {
      -    "enum": [
      -      "SPAN",
      -      "GENERATION",
      -      "EVENT"
      -    ],
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "enum": [
      +      "SPAN",
      +      "GENERATION",
      +      "EVENT",
      +      "AGENT",
      +      "TOOL",
      +      "CHAIN",
      +      "RETRIEVER",
      +      "EVALUATOR",
      +      "EMBEDDING",
      +      "GUARDRAIL"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / type / description
      Previous value: -"The observation type to filter by ('SPAN', 'GENERATION', or 'EVENT')"New value: +"The observation type to filter by (SPAN, GENERATION, EVENT, AGENT, TOOL, CHAIN, RETRIEVER, EVALUATOR, EMBEDDING or GUARDRAIL)"
  2. Changed2 schema fields changedv0.9.0
    • addedInput schema / properties / age / exclusiveMinimum
      Added value: +0
    • addedInput schema / properties / age / maximum
      Added value: +10080
  3. First observed

TDQS

B3.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral burden. It does disclose the three output_mode behaviors and what each returns, which is genuinely useful. But it omits safety profile, permission requirements, pagination limits, and truncation behavior for large result sets — meaningful gaps for a data-retrieval tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose statement is front-loaded, but the Args block duplicates schema text almost word for word, which is waste rather than value. The Returns section is a reasonable summary but the whole docstring is longer than needed for what it adds.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so the description need not explain return shapes — and its Returns section is broadly consistent with the output_mode enum. Combined with full schema coverage, an agent has enough to call the tool correctly. It is not complete enough for a 5 given the absent usage routing versus `fetch_observation`.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all nine parameters including enum values and defaults. The description's Args block largely restates the schema text verbatim (e.g., 'Minutes ago to start looking') without adding format, interaction, or constraint detail. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource: 'Get observations filtered by type and other criteria.' An agent immediately knows this is a filtered observation-list retrieval. However, it does not distinguish itself from the sibling `fetch_observation` (singular), which is the most likely confusion point, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this versus alternatives such as `fetch_observation`, `fetch_traces`, or `fetch_sessions`. It does not state prerequisites, when-not-to-use conditions, or the meaning of 'other criteria' beyond listing parameters. The `age` parameter is required but the description never explains that it is mandatory.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.