Skip to main content
Glama
zinin

sketchup-mcp2

by zinin

undo

Reverse the last atomic operation in SketchUp to undo your most recent modeling step.

Instructions

Undo the last atomic operation in SketchUp. One MCP tool-call = one undo step.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'undo' tool handler function. Decorated with @mcp.tool(), it delegates to _call(ctx, 'undo') which sends the command to the Ruby backend via JSON-RPC.
    @mcp.tool()
    async def undo(ctx: Context) -> str:
        """Undo the last atomic operation in SketchUp. One MCP tool-call = one undo step."""
        return await _call(ctx, "undo")
  • _call() function invoked by the undo handler. Acquires the connection via get_connection(), sends 'undo' command via send_command(), and formats the JSON-RPC response for the LLM.
    async def _call(ctx: Context, tool_name: str, /, **kwargs) -> str:
        """Dispatch a tool call to SketchUp and shape the response for Claude.
    
        Same external contract as before — kept for compatibility with the 22
        existing string-returning tools. Now delegates to :func:`_raw_call`
        for connection acquisition and converts the result to a string.
        Connection failures surface as the canonical legacy string so the LLM
        sees a stable, actionable hint.
        """
        try:
            result = await _raw_call(ctx, tool_name, **kwargs)
        except ConnectionError as e:
            return f"SketchUp not running or extension not started: {e}"
        except SketchUpError as e:
            return format_error(e, debug=config.LOG_LEVEL == "DEBUG")
        content = result.get("content") if isinstance(result, dict) else None
        if (
            isinstance(content, list)
            and content
            and isinstance(content[0], dict)
            and "text" in content[0]
        ):
            return content[0]["text"]
        return json.dumps(result)
  • send_command method on SketchUpConnection that dispatches the 'undo' tool name as a JSON-RPC tools/call request to the Ruby side. Note: 'undo' is NOT in _RETRY_SAFE_TOOLS (it's a mutation tool), so stale-socket errors are not retried.
    async def send_command(self, name: str, args: dict[str, Any]) -> Any:
        async with self._lock:
            try:
                return await self._send_once(name, args)
            except _StaleSocketError:
                # `disconnect()` уже сделан внутри `_send_once`.
                # Retry ТОЛЬКО для side-effect-free tools: Ruby `write_response`
                # может закрыть сокет уже после `commit_operation`, и тогда
                # partial=b"" не гарантирует, что мутации не было.
                if name not in _RETRY_SAFE_TOOLS:
                    raise
                return await self._send_once(name, args)
  • FastMCP application instance created at module level. The side-effect import of sketchup_mcp.tools (line 51) triggers registration of the @mcp.tool() decorator on the undo handler.
    mcp = FastMCP(
        "SketchupMCP",
        instructions="Sketchup integration through the Model Context Protocol",
        lifespan=server_lifespan,
    )
    
    # Side-effect import: registers tool handlers on `mcp`. Must come AFTER `mcp`
    # is constructed (tools.py does `from sketchup_mcp.app import mcp`). Required
    # here so MCP hosts loading the published `[project.entry-points.mcp]` get a
    # FastMCP with tools registered, not an empty instance.
    import sketchup_mcp.tools  # noqa: E402, F401
    import sketchup_mcp.prompts  # noqa: E402, F401
  • Documentation in the modeling strategy prompt explaining that the undo MCP tool internally uses Sketchup.send_action('editUndo:') on the Ruby side.
    - Sketchup::Model#undo does not exist. The undo MCP tool uses
      Sketchup.send_action("editUndo:") internally — just call it.
Behavior3/5

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

No annotations are provided, so the description must carry the burden. It discloses the atomic operation and one-to-one mapping, but does not address redo stack behavior, error conditions (e.g., nothing to undo), or the scoping of 'atomic operation'.

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?

Two sentences, front-loaded information, no unnecessary words. Efficient and direct.

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?

Given the tool's simplicity and the presence of an output schema, the description covers the core functionality. However, it could mention limitations (e.g., history depth, non-undoable operations) for completeness.

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 zero parameters, and the schema has 100% coverage. The description adds no parameter info, but with no parameters, baseline is 4.

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 it undoes the last atomic operation in SketchUp, with a specific verb and resource. It distinguishes itself from sibling tools like create_component or boolean_operation by being the inverse operation.

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

Usage Guidelines4/5

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

The description implies usage for undoing the most recent operation and clarifies that one tool-call equals one undo step. However, it does not explicitly state when not to use it or mention alternatives (e.g., how to undo multiple steps).

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/zinin/sketchup-mcp2'

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