Skip to main content
Glama

Clear Selection

photopea_clear_selection
Idempotent

Remove the current selection in your Photopea document to clear marching ants after completing selection-based operations like fills or adjustments. Leaves pixel data unchanged.

Instructions

Deselect the current selection in the active document, removing the marching ants. Does not modify any pixel data. Use after fill_selection or other selection-based operations are complete.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function that executes the clear selection logic: builds the script via buildClearSelection(), sends activity, executes the script, and returns success/error.
    }, async (_params) => {
      const script = buildClearSelection();
      bridge.sendActivity({ type: "activity", id: "", tool: "clear_selection", summary: "Clear selection" });
      const result = await bridge.executeScript(script);
      if (!result.success) return { isError: true, content: [{ type: "text" as const, text: result.error || "Failed to clear selection" }] };
      return { content: [{ type: "text" as const, text: "Selection cleared" }] };
    });
  • Registration of the 'photopea_clear_selection' tool with MCP server, including title, description, empty inputSchema, and annotations.
    server.registerTool("photopea_clear_selection", {
      title: "Clear Selection",
      description: "Deselect the current selection in the active document, removing the marching ants. Does not modify any pixel data. Use after fill_selection or other selection-based operations are complete.",
      inputSchema: {},
      annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
    }, async (_params) => {
      const script = buildClearSelection();
      bridge.sendActivity({ type: "activity", id: "", tool: "clear_selection", summary: "Clear selection" });
      const result = await bridge.executeScript(script);
      if (!result.success) return { isError: true, content: [{ type: "text" as const, text: result.error || "Failed to clear selection" }] };
      return { content: [{ type: "text" as const, text: "Selection cleared" }] };
    });
  • Input schema is empty object ({}) - this tool takes no parameters.
    inputSchema: {},
  • Helper function buildClearSelection() that generates the Photoshop/Photopea script to deselect the current selection.
    export function buildClearSelection(): string {
      return `app.activeDocument.selection.deselect();\napp.echoToOE('ok');`;
    }
  • Import of buildClearSelection from the script-builder module.
      buildClearSelection,
      escapeString,
    } from "../bridge/script-builder.js";
Behavior4/5

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

The description states 'does not modify any pixel data,' which aligns with the destructiveHint=false annotation. While annotations already cover safety, the description adds context about the selection state, though it doesn't disclose additional behavioral traits beyond what's already in annotations.

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 two concise sentences, front-loading the core purpose and then adding usage context. Every sentence adds value, with no waste.

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

Completeness5/5

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

Given the tool's simplicity (no parameters, no output schema), the description fully covers what the tool does and when to use it. It provides sufficient context for an AI agent to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are no parameters (schema coverage 100%), so the description doesn't need to add parameter meaning. Baseline 4 is appropriate as it correctly implies no arguments are needed.

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 tool deselects the current selection and removes the marching ants. It uses a specific verb ('deselect') and resource ('selection'), and clearly distinguishes from sibling tools like make_selection and modify_selection.

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 says to use the tool 'after fill_selection or other selection-based operations are complete,' providing clear when-to-use guidance and indicating it does not modify pixel data.

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/attalla1/photopea-mcp-server'

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