Skip to main content
Glama

Get a media attachment metadata

getMedia

Fetch metadata for a media attachment by its ID. Works with images, audio, and files.

Instructions

Fetch metadata for a media attachment (image, audio, file) by id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mediaIdYes

Implementation Reference

  • Handler function for getMedia tool - makes GET request to /api/public/media/{mediaId} to fetch media attachment metadata
      async ({ mediaId }) => asJson(await client.get(`/api/public/media/${enc(mediaId)}`)),
    );
  • Input schema for getMedia, requiring a mediaId string with min length 1
    inputSchema: { mediaId: z.string().min(1) },
  • src/tools.ts:369-377 (registration)
    Registration of getMedia tool via server.registerTool with title, description, inputSchema, and handler
    server.registerTool(
      "getMedia",
      {
        title: "Get a media attachment metadata",
        description: "Fetch metadata for a media attachment (image, audio, file) by id.",
        inputSchema: { mediaId: z.string().min(1) },
      },
      async ({ mediaId }) => asJson(await client.get(`/api/public/media/${enc(mediaId)}`)),
    );
  • src/tools.ts:418-420 (registration)
    getMedia included in the TOOL_NAMES exported const array
      "getMedia",
      "getHealth",
    ] as const;
  • The LangfuseClient.get method used by the handler to make authenticated API requests
    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 provided, and the description only states the action without any behavioral traits like idempotency, authentication requirements, or side effects. The tool is likely read-only, but this is not explicitly stated.

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 description is a single sentence, which is concise, but it is too brief to provide adequate context. It covers the basic purpose but lacks structure or additional detail.

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 the tool's simplicity (one parameter, no output schema), the description only satisfies the minimal requirement. It does not explain return values, error cases, or the scope of 'metadata'.

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

Parameters1/5

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

Schema description coverage is 0%, meaning the description adds no information about the mediaId parameter beyond what is in the schema. It does not explain its format, constraints, or typical usage.

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 verb 'Fetch' clearly indicates a read operation, and the resource is specified as 'media attachment (image, audio, file) by id'. However, it does not differentiate from sibling 'get' tools like getComment or getDataset, which also fetch by ID.

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 guidance on when to use this tool over alternatives, such as listMedia or other retrieval tools. There is no mention of prerequisites or context where this tool is appropriate.

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