Skip to main content
Glama

rotate_image

Rotate images by specified angles to adjust orientation or correct alignment. Specify input/output paths, rotation angle, and background color for exposed areas.

Instructions

Rotate an image by specified degrees

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputPathYesPath to input image
outputPathYesPath to save rotated image
angleYesRotation angle in degrees (positive = clockwise)
backgroundNoBackground color for exposed areas (hex or named color)#000000

Implementation Reference

  • The handler for the 'rotate_image' tool. It destructures the arguments, ensures the output directory exists, uses Sharp to rotate the image by the specified angle with optional background color, saves it to the output path, and returns a success message.
    case 'rotate_image': {
      const { inputPath, outputPath, angle, background = '#000000' } = args;
      
      await fs.mkdir(path.dirname(outputPath), { recursive: true });
      
      await sharp(inputPath)
        .rotate(angle, { background })
        .toFile(outputPath);
      
      return {
        content: [
          {
            type: 'text',
            text: `Image rotated ${angle}° successfully. Saved to: ${outputPath}`
          }
        ]
      };
    }
  • Input schema for the 'rotate_image' tool defining the expected parameters: inputPath (required), outputPath (required), angle (required number of degrees), and optional background color.
    inputSchema: {
      type: 'object',
      properties: {
        inputPath: { type: 'string', description: 'Path to input image' },
        outputPath: { type: 'string', description: 'Path to save rotated image' },
        angle: {
          type: 'number',
          description: 'Rotation angle in degrees (positive = clockwise)'
        },
        background: {
          type: 'string',
          description: 'Background color for exposed areas (hex or named color)',
          default: '#000000'
        }
      },
      required: ['inputPath', 'outputPath', 'angle']
    }
  • src/index.ts:117-137 (registration)
    Registration of the 'rotate_image' tool in the ListToolsRequestSchema handler, providing the tool name, description, and input schema.
    {
      name: 'rotate_image',
      description: 'Rotate an image by specified degrees',
      inputSchema: {
        type: 'object',
        properties: {
          inputPath: { type: 'string', description: 'Path to input image' },
          outputPath: { type: 'string', description: 'Path to save rotated image' },
          angle: {
            type: 'number',
            description: 'Rotation angle in degrees (positive = clockwise)'
          },
          background: {
            type: 'string',
            description: 'Background color for exposed areas (hex or named color)',
            default: '#000000'
          }
        },
        required: ['inputPath', 'outputPath', 'angle']
      }
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the rotation action but fails to describe key behaviors: whether the original file is modified or a new file is created, what happens if paths are invalid, if there are size/format limitations, or what the output looks like. This leaves significant gaps for a mutation tool.

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 zero wasted words. It's front-loaded with the core action and resource, making it easy to scan and understand immediately.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain the behavioral implications (e.g., file creation vs. modification), error conditions, or output format. Given the complexity of image processing and lack of structured safety hints, 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?

The schema description coverage is 100%, so the input schema already documents all parameters thoroughly. The description adds no additional semantic context beyond implying rotation, which the schema's 'angle' parameter already covers. This meets the baseline for high schema coverage.

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 ('rotate') and resource ('an image'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'flip_image' or 'crop_image' which also transform images, missing an opportunity to clarify when rotation is specifically needed versus other transformations.

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 'flip_image' or 'crop_image', nor does it mention prerequisites such as needing valid image files. It simply states what the tool does without contextual usage information.

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/flowy11/imagician'

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