Skip to main content
Glama

read-xmp

Extract XMP metadata from images to access embedded information, with support for extended XMP segments when needed.

Instructions

Read XMP metadata from an image with option for extended XMP segments

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageYes
extendedNo

Implementation Reference

  • The core handler function that implements the logic for the 'read-xmp' tool. It destructures the input arguments, loads the image into a buffer, builds XMP-specific parsing options, extracts metadata using the exifr library, checks for XMP presence, and returns a standardized success or error response.
    async (args, extra) => {
      try {
        const { image, extended } = args;
        const buf = await loadImage(image);
        const opts = buildXmpOptions(extended);
        const meta = await exifr.parse(buf, opts);
        
        if (!meta || !meta.xmp) {
          return createErrorResponse('No XMP metadata found in image');
        }
        
        return createSuccessResponse(meta);
      } catch (error) {
        return createErrorResponse(`Error reading XMP data: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Registers the 'read-xmp' tool with the MCP server instance using server.tool(), providing the tool name, description, input schema, and handler function. Also stores a reference in the tools object for testing purposes.
    // Tool 3: read-xmp - reads XMP data
    const readXmpTool = server.tool('read-xmp',
      "Read XMP metadata from an image with option for extended XMP segments",
      {
        image: ImageSourceSchema,
        extended: z.boolean().optional()
      },
      async (args, extra) => {
        try {
          const { image, extended } = args;
          const buf = await loadImage(image);
          const opts = buildXmpOptions(extended);
          const meta = await exifr.parse(buf, opts);
          
          if (!meta || !meta.xmp) {
            return createErrorResponse('No XMP metadata found in image');
          }
          
          return createSuccessResponse(meta);
        } catch (error) {
          return createErrorResponse(`Error reading XMP data: ${error instanceof Error ? error.message : String(error)}`);
        }
      }
    );
    tools['read-xmp'] = readXmpTool;
  • Zod schema defining the standardized ImageSource input parameter used by the 'read-xmp' tool (and other image tools). Supports path, URL, base64, or buffer inputs.
    const ImageSourceSchema = z.object({
      kind: z.enum(['path', 'url', 'base64', 'buffer']),
      path: z.string().optional(),
      url: z.string().optional(),
      data: z.string().optional(),
      buffer: z.string().optional()
    });
  • Helper function that creates exifr parsing options specifically tailored for XMP metadata extraction, enabling only XMP parsing and optionally multi-segment support for extended XMP.
    /**
     * Creates options object for the read-xmp tool
     * @param extended Whether to read extended XMP segments
     * @returns Options object configured for XMP reading
     */
    export function buildXmpOptions(extended?: boolean): ExifrOptions {
      return {
        tiff: false,
        xmp: true,
        icc: false,
        iptc: false,
        jfif: false,
        ihdr: false,
        multiSegment: extended ?? false
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool reads metadata, implying a read-only operation, but doesn't cover important aspects like error handling, performance characteristics, or what happens with invalid inputs. The mention of 'extended XMP segments' adds some context but is insufficient for a tool with complex input structure.

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

Conciseness5/5

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

The description is extremely concise at just one sentence with zero wasted words. It's front-loaded with the core purpose and includes the key option. Every word serves a purpose in this compact form.

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 complexity (nested objects in input schema, no output schema, no annotations), the description is inadequate. It doesn't explain the return format, error conditions, or how to interpret the 'image' parameter's complex structure. For a tool that reads metadata with multiple input types, more context is needed.

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?

With 0% schema description coverage, the description must compensate but only partially does so. It mentions 'image' and 'extended XMP segments' which map to the two parameters, but provides no details about the complex 'image' object structure or what 'extended' actually means. The description adds minimal value beyond what's implied by parameter names.

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 verb 'Read' and the resource 'XMP metadata from an image', which is specific and unambiguous. It distinguishes from some siblings like 'read-exif' or 'read-iptc' by specifying XMP metadata, though it doesn't explicitly differentiate from 'read-metadata' which might be broader.

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?

The description provides no guidance on when to use this tool versus alternatives like 'read-exif' or 'read-metadata'. It mentions 'extended XMP segments' as an option but doesn't explain when this is necessary or beneficial compared to other metadata reading tools.

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/stass/exif-mcp'

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