Skip to main content
Glama

orientation

Extract image orientation values (1-8) from EXIF metadata to determine correct display rotation for images from files, URLs, or encoded data.

Instructions

Get image orientation value (1-8)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageYes

Implementation Reference

  • The handler function that executes the 'orientation' tool logic: loads the image into a buffer, extracts the orientation value (1-8) using exifr.orientation, and returns a success response with the value or an appropriate error.
    async (args, extra) => {
      try {
        const { image } = args;
        const buf = await loadImage(image);
        const orientation = await exifr.orientation(buf);
        
        if (orientation === undefined) {
          return createErrorResponse('No orientation metadata found in image');
        }
        
        return createSuccessResponse({ orientation });
      } catch (error) {
        return createErrorResponse(`Error reading orientation: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Zod input schema for the 'image' parameter, defining supported source kinds (path, url, base64, buffer) used by the 'orientation' 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()
    });
  • Registers the 'orientation' tool with the MCP server via server.tool(), providing name, description, input schema, and handler function. Also stores reference for testing.
    const orientationTool = server.tool('orientation',
      "Get image orientation value (1-8)",
      {
        image: ImageSourceSchema
      },
      async (args, extra) => {
        try {
          const { image } = args;
          const buf = await loadImage(image);
          const orientation = await exifr.orientation(buf);
          
          if (orientation === undefined) {
            return createErrorResponse('No orientation metadata found in image');
          }
          
          return createSuccessResponse({ orientation });
        } catch (error) {
          return createErrorResponse(`Error reading orientation: ${error instanceof Error ? error.message : String(error)}`);
        }
      }
    );
    tools['orientation'] = orientationTool;
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. It states it 'gets' a value, implying a read-only operation, but doesn't disclose behavioral traits like error handling (e.g., what happens with invalid images), performance characteristics, or authentication needs. The description is minimal and lacks context about what the tool actually does beyond the basic purpose.

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—a single sentence with zero waste. It's front-loaded with the core purpose and includes the output range. Every word earns its place, making it easy to parse quickly without unnecessary elaboration.

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 (1 parameter with nested objects, no annotations, no output schema), the description is incomplete. It doesn't explain the input format, output details beyond the range 1-8, or how orientation values map to image rotations. For a tool that likely reads image metadata, more context is needed to use it effectively without trial and error.

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 adds no parameter semantics beyond what the schema provides. Schema description coverage is 0%, and the description doesn't explain the 'image' parameter or its nested properties (kind, path, url, etc.). With 1 parameter and high schema complexity (nested object with enums), the description fails to compensate for the lack of schema descriptions, but the baseline is 3 since it doesn't mislead about parameters.

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 'Get' and the resource 'image orientation value', specifying the output range (1-8). It distinguishes from siblings like 'gps-coordinates' or 'rotation-info' by focusing specifically on orientation values rather than other metadata or transformations. However, it doesn't explicitly differentiate from all siblings (e.g., 'read-exif' might also provide orientation).

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. With siblings like 'read-exif' (which might include orientation) and 'rotation-info' (which sounds related), there's no indication of when this specific orientation tool is preferred. No context about prerequisites or limitations is mentioned.

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