Skip to main content
Glama

Get observation by id

getObservation

Retrieve a specific observation from Langfuse by its ID.

Instructions

Fetch a single observation by id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
observationIdYes

Implementation Reference

  • src/tools.ts:66-75 (registration)
    Registration of the 'getObservation' tool on the MCP server via registerTool(). Defines title, description, input schema, and handler.
    server.registerTool(
      "getObservation",
      {
        title: "Get observation by id",
        description: "Fetch a single observation by id.",
        inputSchema: { observationId: z.string().min(1) },
      },
      async ({ observationId }) =>
        asJson(await client.get(`/api/public/observations/${enc(observationId)}`)),
    );
  • Input schema for getObservation: requires a single 'observationId' string (min length 1) validated with Zod.
    {
      title: "Get observation by id",
      description: "Fetch a single observation by id.",
      inputSchema: { observationId: z.string().min(1) },
    },
  • Handler function for getObservation: destructures observationId, makes a GET request to the Langfuse API at /api/public/observations/{observationId}, and returns the JSON result.
      async ({ observationId }) =>
        asJson(await client.get(`/api/public/observations/${enc(observationId)}`)),
    );
  • Helper function 'asJson' used by the handler to wrap the API response in MCP text content format.
    const asJson = (data: unknown) => ({
      content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
    });
  • URI encoding helper 'enc' used to safely encode the observationId in the URL path.
    const enc = encodeURIComponent;
Behavior3/5

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

With no annotations, the description must disclose behavior. 'Fetch' implies a read operation, but does not explain idempotency, error handling (e.g., not found scenario), or any side effects. Basic behavior is conveyed but lacks depth.

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

Conciseness4/5

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

The description is a single concise sentence with no unnecessary words. It is front-loaded with the action and resource. It could potentially include more structure but is appropriately brief for a simple retrieval tool.

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

Completeness3/5

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

Given the tool's simplicity (single parameter, no output schema), the description covers the basic purpose but omits details like return format, error behavior, or whether the id is globally unique. It is adequate for a straightforward fetch but not fully complete.

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

Parameters2/5

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

The input schema has one parameter (observationId) with no description in the schema. The description does not add any meaning beyond the schema, such as format expectations or constraints. With 0% schema description coverage, the description fails to compensate.

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

Purpose5/5

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

The description clearly states the action (Fetch), the resource (observation), and the unique identifier (by id). This distinguishes it from sibling tools like listObservations that return multiple records.

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

Usage Guidelines3/5

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

The description implies use for single observations, but does not explicitly state when to use this versus alternatives like listObservations or other get tools. No exclusions or alternative guidance is provided.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hugoles/langfuse-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server