feat: add create_design tool so the MCP can create canvases

Wrap POST /api/v1/designs so AI clients can create a new design (canvas) and get its id back for use as design_id. Completes the create-and-target canvas workflow alongside list_designs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Nicola Bottini
2026-07-09 15:01:28 -04:00
committed by Pouzor
parent 6e3d45fddc
commit 2d00be71bb
2 changed files with 25 additions and 0 deletions
+12
View File
@@ -134,6 +134,15 @@ def _build_tools() -> list[Tool]:
"type": "object",
"properties": {},
}),
Tool(name="create_design", description="Create a new design (canvas) and return it, including its id for use as design_id", inputSchema={
"type": "object",
"required": ["name"],
"properties": {
"name": {"type": "string", "description": "Name of the new canvas."},
"icon": {"type": "string", "description": "Icon name for the canvas (default: dashboard)."},
"design_type": {"type": "string", "description": "Design type (default: network)."},
},
}),
]
@@ -220,4 +229,7 @@ async def _dispatch(name: str, args: dict) -> dict:
if name == "list_designs":
return await backend.get("/api/v1/designs")
if name == "create_design":
return await backend.post("/api/v1/designs", args)
raise ValueError(f"Unknown tool: {name}")