fix: normalize MCP tool error formatting

This commit is contained in:
2026-06-12 13:03:47 +01:00
parent b65ee3a598
commit d94f5b97c1
4 changed files with 92 additions and 20 deletions
+12 -1
View File
@@ -105,9 +105,20 @@ Four additional MCP tools registered on the server (`src/server.js`):
- All handlers use existing modules only (no new imports or files).
- SDK quirk: `isError: true` wraps results in JSON-RPC error envelope (`code: -32603`).
### Task 5.4 - Normalize MCP tool error formatting ✅
MCP tool error formatting normalized in `src/server.js`. All 5 tool registrations now produce a single "Error:" prefix — no more duplicate `"Error: Error:"` strings.
**Changes:** Each tool callback normalizes the error text before returning:
- If `result.error` already starts with `"Error:"`, it is used as-is.
- Otherwise, `"Error: "` is prepended.
- `result.ok` responses are unchanged.
Smoke tests: npm test 523 passed ✅ · tools/list 5 tools ✅ · ask_chatgpt single prefix ✅ · review_plan single prefix ✅
## Next Pending
### Task 5.4 - Normalize MCP tool error formatting
### Task 5.5 - Claude Code MCP configuration and local end-to-end setup
## General Rules