Skip to main content
Glama

Get a single score by id

getScore

Retrieve a specific score from Langfuse by providing its unique ID. Access evaluation data for analysis.

Instructions

Fetch a single score by id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scoreIdYes

Implementation Reference

  • The handler function for 'getScore' tool. It accepts a 'scoreId' parameter, URL-encodes it, and makes a GET request to /api/public/scores/{scoreId} via the LangfuseClient. The response is returned as formatted JSON text.
    server.registerTool(
      "getScore",
      {
        title: "Get a single score by id",
        description: "Fetch a single score by id.",
        inputSchema: { scoreId: z.string().min(1) },
      },
      async ({ scoreId }) => asJson(await client.get(`/api/public/scores/${enc(scoreId)}`)),
    );
  • The input schema for 'getScore' defines a single required string parameter 'scoreId' (min length 1), validated using Zod.
      inputSchema: { scoreId: z.string().min(1) },
    },
  • src/tools.ts:120-128 (registration)
    The tool named 'getScore' is registered via server.registerTool() inside the registerTools() function. It appears in the scores section of tools.ts.
    server.registerTool(
      "getScore",
      {
        title: "Get a single score by id",
        description: "Fetch a single score by id.",
        inputSchema: { scoreId: z.string().min(1) },
      },
      async ({ scoreId }) => asJson(await client.get(`/api/public/scores/${enc(scoreId)}`)),
    );
  • The LangfuseClient.get() method is the underlying HTTP helper that the 'getScore' handler calls. It constructs the URL with query params, sets Basic auth, performs the fetch, and parses the JSON response.
      async get(path: string, params: QueryParams = {}): Promise<unknown> {
        const url = new URL(`${this.baseUrl}${path}`);
    
        for (const [key, value] of Object.entries(params)) {
          if (value === undefined || value === null || value === "") continue;
          if (Array.isArray(value)) {
            for (const item of value) url.searchParams.append(key, String(item));
          } else {
            url.searchParams.set(key, String(value));
          }
        }
    
        const response = await fetch(url, {
          headers: {
            Authorization: this.authHeader,
            Accept: "application/json",
          },
        });
    
        const text = await response.text();
    
        if (!response.ok) {
          throw new LangfuseError(
            `Langfuse API ${response.status} ${response.statusText}: ${text.slice(0, 500)}`,
            response.status,
            text,
          );
        }
    
        try {
          return JSON.parse(text) as unknown;
        } catch {
          throw new LangfuseError(
            `Langfuse API returned non-JSON response from ${url.pathname}: ${text.slice(0, 200)}`,
            response.status,
            text,
          );
        }
      }
    }
Behavior2/5

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

No annotations are present, so the description must disclose behavioral traits. It fails to mention what happens on missing ID, potential errors, return format, or side effects. The description is insufficient for safe invocation.

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 extremely concise at one sentence with no redundant information. However, conciseness compromises completeness; it earns its place but leaves significant gaps.

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

Completeness2/5

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

Given no output schema and minimal description, the tool is under-specified. It does not explain what a 'score' represents in the domain, leaving the agent unsure about the return value or usage context.

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 only parameter scoreId has 0% schema description coverage. The description merely repeats 'by id' without adding semantic meaning, such as expected format (e.g., UUID) or constraints beyond minLength.

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?

The description clearly states the action (fetch) and resource (score) with the method (by id). However, it does not differentiate from sibling tools like getScoreConfig or getMetrics, which are also fetch operations with different entities.

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?

No usage guidelines are provided. The description does not specify when to use this tool versus alternatives like listScores, nor does it mention any prerequisites or context for invocation.

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