Skip to main content
Glama

draw_rectangle

Add rectangular shapes to pixel art projects by specifying coordinates and color, with options for outlines or filled areas to create sprites and animations.

Instructions

Draw a rectangle (outline or filled)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject identifier
layerIndexNoLayer index (default: 0)
frameIndexNoFrame index (default: 0)
x0YesTop-left X coordinate
y0YesTop-left Y coordinate
x1YesBottom-right X coordinate
y1YesBottom-right Y coordinate
colorYesColor in hex format
filledNoWhether to fill the rectangle (default: false)
penSizeNoStroke width for outline (default: 1)

Implementation Reference

  • The actual logic for drawing the rectangle outline.
    export function drawRectangle(
      frame: Frame,
      x0: number,
      y0: number,
      x1: number,
      y1: number,
      color: number | string,
      penSize: number = 1
    ): number {
      const colorInt = typeof color === 'string' ? colorToInt(color) : color;
      const pixels = getRectangleStrokePixels(x0, y0, x1, y1, penSize);
    
      let count = 0;
      for (const [x, y] of pixels) {
        if (frame.containsPixel(x, y)) {
          frame.setPixel(x, y, colorInt);
          count++;
        }
  • The server-side handler that processes the MCP request and calls the drawing function.
    private drawRectangleTool(
      projectId: string,
      layerIndex: number,
      frameIndex: number,
      x0: number,
      y0: number,
      x1: number,
      y1: number,
      color: string,
      filled: boolean,
      penSize: number
    ): object {
      const frame = this.getFrame(projectId, layerIndex, frameIndex);
      const count = filled
        ? drawFilledRectangle(frame, x0, y0, x1, y1, color)
  • The registration of the draw_rectangle tool in the server's tool list.
    name: 'draw_rectangle',
    description: 'Draw a rectangle (outline or filled)',
    inputSchema: {
      type: 'object',
      properties: {
        projectId: {
          type: 'string',
          description: 'Project identifier',
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 rectangle can be outline or filled, which hints at visual output, but fails to describe what the tool actually does (e.g., modifies a project's visual layer, may require specific permissions, or has side effects like overwriting existing content). For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 waste—it directly states the tool's function without unnecessary words. It's appropriately sized for a straightforward drawing tool and front-loaded with the core action.

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 tool's complexity (10 parameters, mutation operation), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns, how errors are handled, or the visual context (e.g., coordinate system units). For a drawing tool that likely modifies project state, more behavioral and output details are needed to guide an agent effectively.

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 documents all 10 parameters thoroughly. The description adds minimal value beyond the schema by implying the rectangle's visual style (outline or filled), but doesn't provide additional context like coordinate systems, color formats beyond hex, or interaction with other parameters. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('draw') and resource ('rectangle') with additional detail about outline or filled options. It distinguishes from siblings like draw_circle, draw_line, and draw_pixel by specifying the shape type, but doesn't explain how it differs from other drawing tools in terms of functionality or use cases.

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 draw_circle or draw_line, nor does it mention prerequisites (e.g., needing an existing project or layer). It lacks context about typical scenarios or constraints, leaving the agent to infer usage from parameter 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/yafeiaa/piskel-mcp-server'

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