Skip to main content
Glama
zinin

sketchup-mcp2

by zinin

list_layers

Retrieve a list of all SketchUp model layers including name, visibility, color, and ID for layer management.

Instructions

List all model layers as {name, visible, color, id}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main tool handler for 'list_layers'. Decorated with @mcp.tool(), it calls _call(ctx, 'list_layers') to dispatch the command to SketchUp.
    @mcp.tool()
    async def list_layers(ctx: Context) -> str:
        """List all model layers as {name, visible, color, id}."""
        return await _call(ctx, "list_layers")
  • The @mcp.tool() decorator on the list_layers function registers it as a FastMCP tool. This import is triggered side-effectfully from app.py.
    @mcp.tool()
    async def list_layers(ctx: Context) -> str:
        """List all model layers as {name, visible, color, id}."""
        return await _call(ctx, "list_layers")
  • The _call helper function dispatches the tool_name ('list_layers') to SketchUp via _raw_call -> send_command, handling errors and response unwrapping.
    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)
    
    
    @mcp.tool()
    async def create_component(
  • list_layers is listed in _RETRY_SAFE_TOOLS (frozenset), meaning it's considered read-only/side-effect-free and safe to retry if the socket becomes stale.
    _RETRY_SAFE_TOOLS: frozenset[str] = frozenset(
        {
            "get_model_info",
            "list_components",
            "get_component_info",
            "find_components",
            "list_layers",
            "get_selection",
            "get_viewport_screenshot",  # read-only viewport capture; idempotent in
                                        # both restore_view modes (no document state changes)
            "get_version",              # read-only diagnostic; no side effects
        }
    )
  • Docstring serves as the schema/description: 'List all model layers as {name, visible, color, id}.'. No input parameters.
    async def list_layers(ctx: Context) -> str:
        """List all model layers as {name, visible, color, id}."""
Behavior3/5

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

No annotations provided. Description only states the output fields, not side effects or read-only nature. Minimal but acceptable for a simple query.

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?

Single sentence, front-loaded with purpose, no unnecessary words. Highly concise.

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 zero parameters and presence of output schema, the description is fully adequate. No gaps remain.

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?

No parameters in schema, so coverage is 100%. Description adds value by listing return fields, which goes beyond the empty schema.

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?

Description clearly states verb 'List' and resource 'model layers', specifies exact fields returned ({name, visible, color, id}), and differentiates from sibling create_layer.

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

Usage Guidelines3/5

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

No explicit when-to-use guidance, but as a basic list tool, usage is implied. No alternatives or exclusions mentioned.

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