rotation-info
Extract image rotation and flip details using the exif-mcp server to accurately analyze orientation metadata for various image formats without external tools.
Instructions
Get detailed rotation and flip information from image orientation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes |
Implementation Reference
- src/tools/index.ts:205-219 (handler)The handler function that executes the tool logic: loads the image buffer and uses exifr.rotation to retrieve rotation and flip information, returning it in a standardized response format or an error.async (args, extra) => { try { const { image } = args; const buf = await loadImage(image); const rotation = await exifr.rotation(buf); if (!rotation) { return createErrorResponse('No rotation metadata found in image'); } return createSuccessResponse(rotation); } catch (error) { return createErrorResponse(`Error reading rotation info: ${error instanceof Error ? error.message : String(error)}`); } }
- src/tools/index.ts:199-221 (registration)The complete registration of the 'rotation-info' tool using server.tool, including name, description, input schema, handler function, and assignment to the tools registry.// Tool 9: rotation-info - gets rotation and flip information const rotationInfoTool = server.tool('rotation-info', "Get detailed rotation and flip information from image orientation", { image: ImageSourceSchema }, async (args, extra) => { try { const { image } = args; const buf = await loadImage(image); const rotation = await exifr.rotation(buf); if (!rotation) { return createErrorResponse('No rotation metadata found in image'); } return createSuccessResponse(rotation); } catch (error) { return createErrorResponse(`Error reading rotation info: ${error instanceof Error ? error.message : String(error)}`); } } ); tools['rotation-info'] = rotationInfoTool;
- src/tools/index.ts:54-60 (schema)Zod schema defining the input structure for the image source parameter used by the rotation-info 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() });
- src/server.ts:19-20 (registration)Top-level call to registerTools which includes the rotation-info tool among others.// Register all tools registerTools(server);