Skip to main content
Glama

set_aspect_ratio

Configure the aspect ratio for image generation and editing sessions to ensure consistent dimensions across creations. Specify ratios like 16:9 or 1:1 before processing images.

Instructions

Set the aspect ratio for subsequent image generation and editing in this session. Must be called before generating/editing images if a specific ratio is desired.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aspect_ratioYesThe aspect ratio to use for image generation/editing
conversation_idNoSession ID to apply this setting to (default: 'default')

Implementation Reference

  • The implementation of the set_aspect_ratio tool handler, which validates the aspect ratio and updates the context for a given conversation.
    case "set_aspect_ratio": {
      const { aspect_ratio, conversation_id = "default" } = args as any;
    
      // Validate aspect ratio
      if (!VALID_ASPECT_RATIOS.includes(aspect_ratio as AspectRatio)) {
        return {
          content: [{
            type: "text",
            text: `Invalid aspect ratio: ${aspect_ratio}. Valid: ${VALID_ASPECT_RATIOS.join(", ")}`,
          }],
          isError: true,
        };
      }
    
      const context = getOrCreateContext(conversation_id);
      context.aspectRatio = aspect_ratio as AspectRatio;
    
      return {
        content: [{
          type: "text",
          text: `✓ Aspect ratio set to ${aspect_ratio} for session: ${conversation_id}\nThis will apply to both image generation and editing.`,
        }],
      };
    }
  • src/index.ts:422-435 (registration)
    Registration of the set_aspect_ratio tool, including its description and input schema definition.
    name: "set_aspect_ratio",
    description: "Set the aspect ratio for subsequent image generation and editing in this session. Must be called before generating/editing images if a specific ratio is desired.",
    inputSchema: {
      type: "object",
      properties: {
        aspect_ratio: {
          type: "string",
          enum: [...VALID_ASPECT_RATIOS],
          description: "The aspect ratio to use for image generation/editing",
        },
        conversation_id: {
          type: "string",
          description: "Session ID to apply this setting to (default: 'default')",
        },
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses that this is a session-level configuration tool that affects subsequent operations, which is valuable behavioral context. However, it doesn't mention whether this setting persists across sessions, what happens if called multiple times, or any error conditions beyond the temporal requirement.

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 uses only two sentences that are completely focused and front-loaded. The first sentence states the purpose, the second provides critical usage guidance. There is zero wasted text or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a configuration tool with 2 parameters and 100% schema coverage but no annotations or output schema, the description provides good context about when and why to use it. It could be more complete by addressing persistence across sessions or error conditions, but it covers the essential operational context adequately.

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?

Schema description coverage is 100%, so the schema already fully documents both parameters. The description doesn't add any parameter-specific information beyond what's in the schema descriptions. This meets the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Set the aspect ratio') and the target ('for subsequent image generation and editing in this session'). It distinguishes this tool from siblings like gemini_generate_image or gemini_edit_image by focusing on configuration rather than creation/modification.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool ('Must be called before generating/editing images if a specific ratio is desired') and implies alternatives (using default ratios if not called). This provides clear temporal and conditional guidance for tool selection.

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/pistachiomatt/nanobanana-mcp'

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