Skip to main content
Glama

read-iptc

Extract IPTC metadata from images to access embedded information like captions, keywords, and copyright details for content management and analysis.

Instructions

Read IPTC metadata from an image

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageYes

Implementation Reference

  • segmentTools array that includes the configuration for the 'read-iptc' tool with segment 'IPTC', used in the subsequent registration loop.
      { name: 'read-icc', segment: 'ICC' },
      { name: 'read-iptc', segment: 'IPTC' },
      { name: 'read-jfif', segment: 'JFIF' },
      { name: 'read-ihdr', segment: 'IHDR' }
    ] as const;
  • Dynamic registration loop that registers the 'read-iptc' tool using server.tool with description, schema, and shared handler function.
    segmentTools.forEach(({ name, segment }) => {
      const segmentTool = server.tool(name,
        `Read ${segment} metadata from an image`,
        {
          image: ImageSourceSchema
        },
        async (args, extra) => {
          try {
            const { image } = args;
            const buf = await loadImage(image);
            const opts = buildSegmentOptions(segment);
            const meta = await exifr.parse(buf, opts);
            
            const segmentKey = segment.toLowerCase();
            if (!meta || !meta[segmentKey]) {
              return createErrorResponse(`No ${segment} metadata found in image`);
            }
            
            return createSuccessResponse(meta);
          } catch (error) {
            return createErrorResponse(`Error reading ${segment} data: ${error instanceof Error ? error.message : String(error)}`);
          }
        }
      );
      tools[name] = segmentTool;
    });
  • Handler function executed for read-iptc: loads image, builds IPTC-specific exifr options, parses and returns IPTC metadata or appropriate error.
      async (args, extra) => {
        try {
          const { image } = args;
          const buf = await loadImage(image);
          const opts = buildSegmentOptions(segment);
          const meta = await exifr.parse(buf, opts);
          
          const segmentKey = segment.toLowerCase();
          if (!meta || !meta[segmentKey]) {
            return createErrorResponse(`No ${segment} metadata found in image`);
          }
          
          return createSuccessResponse(meta);
        } catch (error) {
          return createErrorResponse(`Error reading ${segment} data: ${error instanceof Error ? error.message : String(error)}`);
        }
      }
    );
  • Zod schema defining the input structure for the 'image' parameter required by the read-iptc tool.
    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 buildSegmentOptions that configures exifr.parse options specifically for IPTC by setting iptc: true when segment='IPTC'.
    export function buildSegmentOptions(segment: 'ICC' | 'IPTC' | 'JFIF' | 'IHDR'): ExifrOptions {
      const options: ExifrOptions = {
        tiff: false,
        xmp: false,
        icc: false,
        iptc: false,
        jfif: false,
        ihdr: false,
      };
      
      const key = segment.toLowerCase() as 'icc' | 'iptc' | 'jfif' | 'ihdr';
      options[key] = true;
      
      return options;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic operation. It doesn't disclose behavioral traits such as error handling (e.g., what happens if the image lacks IPTC data), performance characteristics, or output format. This is inadequate for a 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.

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core purpose, making it easy to parse quickly. Every word earns its place by conveying essential information.

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 object parameter, no output schema, no annotations), the description is insufficient. It doesn't explain what IPTC metadata includes, the return format, or error cases. For a metadata-reading tool with rich input structure, more context is needed to guide effective use.

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?

The description mentions 'image' but doesn't explain the parameter's structure or the 'kind' enum values (path, url, base64, buffer). With 0% schema description coverage, it fails to compensate for the lack of schema documentation, though the single parameter is implied. Baseline 3 applies as the schema handles the structure.

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 ('Read') and resource ('IPTC metadata from an image'), making the tool's purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'read-exif' or 'read-metadata' that also read metadata, leaving some ambiguity about when to choose this specific tool.

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 lacks context about specific use cases, prerequisites, or exclusions, leaving the agent to infer usage based on tool names alone.

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