Skip to main content
Glama
mhyrr
by mhyrr

create_component

Generate and position 3D components like cubes in Sketchup using specified dimensions and coordinates, enabling direct 3D modeling and scene manipulation through integration with Claude AI.

Instructions

Create a new component in Sketchup

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dimensionsNo
positionNo
typeNocube

Implementation Reference

  • The handler function for the 'create_component' MCP tool. It connects to Sketchup via socket, sends a JSON-RPC 'tools/call' request with the tool name and arguments, and returns the result as JSON string. The function signature defines the input schema (type, position, dimensions). The @mcp.tool() decorator handles registration.
    @mcp.tool()
    def create_component(
        ctx: Context,
        type: str = "cube",
        position: List[float] = None,
        dimensions: List[float] = None
    ) -> str:
        """Create a new component in Sketchup"""
        try:
            logger.info(f"create_component called with type={type}, position={position}, dimensions={dimensions}, request_id={ctx.request_id}")
            
            sketchup = get_sketchup_connection()
            
            params = {
                "name": "create_component",
                "arguments": {
                    "type": type,
                    "position": position or [0,0,0],
                    "dimensions": dimensions or [1,1,1]
                }
            }
            
            logger.info(f"Calling send_command with method='tools/call', params={params}, request_id={ctx.request_id}")
            
            result = sketchup.send_command(
                method="tools/call",
                params=params,
                request_id=ctx.request_id
            )
            
            logger.info(f"create_component result: {result}")
            return json.dumps(result)
        except Exception as e:
            logger.error(f"Error in create_component: {str(e)}")
            return f"Error creating component: {str(e)}"
Install Server

Other Tools

Related 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/mhyrr/sketchup-mcp'

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