get_selection
Retrieve currently selected components in Sketchup for real-time 3D modeling and scene manipulation through direct integration with the SketchupMCP server.
Instructions
Get currently selected components
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_selection"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/sketchup_mcp/server.py:343-359 (handler)The main handler function for the 'get_selection' MCP tool. It establishes a connection to SketchUp via socket, sends a JSON-RPC 'tools/call' request to SketchUp's 'get_selection' tool with empty arguments, and returns the JSON-encoded result or an error message.
@mcp.tool() def get_selection(ctx: Context) -> str: """Get currently selected components""" try: sketchup = get_sketchup_connection() result = sketchup.send_command( method="tools/call", params={ "name": "get_selection", "arguments": {} }, request_id=ctx.request_id ) return json.dumps(result) except Exception as e: return f"Error getting selection: {str(e)}"