fix: rename edit_diagram type field to operation for better model compatibility (#402)

Fixes #374 - Models were confused by the `type` field name and sent
`operation` instead. This change:

- Renames DiagramOperation.type to DiagramOperation.operation across
  all files (MCP server, web app, hooks, components, system prompts)
- Adds JSON examples in tool descriptions to show correct format
- Updates all test data to use the new field name

Affected files:
- lib/utils.ts
- app/api/chat/route.ts
- hooks/use-diagram-tool-handlers.ts
- components/chat-message-display.tsx
- lib/system-prompts.ts
- packages/mcp-server/src/diagram-operations.ts
- packages/mcp-server/src/index.ts
- scripts/test-diagram-operations.mjs

MCP server version bumped to 0.1.6
This commit is contained in:
Dayuan Jiang
2025-12-25 13:19:04 +09:00
committed by GitHub
parent ed069afdea
commit 3047d19238
9 changed files with 78 additions and 62 deletions

View File

@@ -30,7 +30,7 @@ type AddToolOutputParams = AddToolOutputSuccess | AddToolOutputError
type AddToolOutputFn = (params: AddToolOutputParams) => void
interface DiagramOperation {
type: "update" | "add" | "delete"
operation: "update" | "add" | "delete"
cell_id: string
new_xml?: string
}