fix: attach MCP-created nodes/edges to a design (#225)

create_node/create_edge persisted rows with design_id=null when the
client omitted it (the MCP write tools), so they existed in the DB but
never rendered on the canvas until a container restart reconciled them.
Both routes now fall back to the first design, matching bulk-approve.

Also fix MCP resource reads (homelable://canvas, homelable://edges):
the framework passes a pydantic AnyUrl, not a str, which raised
"'AnyUrl' object has no attribute 'startswith'". Coerce to str.

EdgeResponse now exposes design_id for symmetry with NodeResponse.

ha-relevant: no
This commit is contained in:
Pouzor
2026-06-28 14:00:59 +02:00
parent 7e99d77edc
commit cbc2bc03c2
7 changed files with 121 additions and 4 deletions
+1
View File
@@ -51,6 +51,7 @@ class EdgeUpdate(BaseModel):
class EdgeResponse(EdgeBase):
id: str
design_id: str | None = None
created_at: datetime
model_config = {"from_attributes": True}