feat: register remaining MCP tools
This commit is contained in:
@@ -491,4 +491,39 @@ await server.connect(new StdioServerTransport());
|
||||
|
||||
Status: ✅ Complete
|
||||
|
||||
### Task 5.3 - Register remaining MCP tools (NEXT)
|
||||
### Task 5.3 - Register remaining MCP tools
|
||||
|
||||
Register `review_plan`, `review_code`, `debug_issue`, and `architecture_review` as MCP tools on the server in `src/server.js`.
|
||||
|
||||
**Requirements:**
|
||||
- Import four existing handlers: `handleReviewPlan`, `handleReviewCode`, `handleDebugIssue`, `handleArchitectureReview`.
|
||||
- Use `baseInputSchema` for all tool input schemas.
|
||||
- Explicitly register each tool with its own `registerTool()` call — no registry abstraction, no dynamic loop.
|
||||
- Pass all three deps (`loadConfig`, `createOpenAIClient`, `sendOpenAIResponse`) into each handler.
|
||||
- Return structured MCP tool result: `{ content: [{ type: "text", text }], isError, warnings }`.
|
||||
|
||||
**Smoke test results (all passing):**
|
||||
|
||||
| Test | Result |
|
||||
|------|--------|
|
||||
| initialize handshake | ✅ Server returns `chatgpt-mcp` v0.1.0 |
|
||||
| tools/list count | ✅ Returns 5 tools total |
|
||||
| all tool names present | ✅ ask_chatgpt, review_plan, review_code, debug_issue, architecture_review |
|
||||
| tools/call each tool (no API key) | ✅ Structured MCP error for all 5: `"Error: Configuration error: OPENAI_API_KEY is missing."` |
|
||||
| npm test | ✅ 523 tests pass across 18 test files — no regressions |
|
||||
|
||||
**Production code (`src/server.js`) changes:**
|
||||
|
||||
- Added imports: `handleReviewPlan`, `handleReviewCode`, `handleDebugIssue`, `handleArchitectureReview`
|
||||
- Added four `registerTool()` calls: `review_plan`, `review_code`, `debug_issue`, `architecture_review`
|
||||
- Existing `ask_chatgpt` registration unchanged
|
||||
- No new files created
|
||||
|
||||
**SDK quirks noted:**
|
||||
|
||||
1. `notifications/initialized` is not handled by the SDK — produces `-32601 Method not found`. Harmless.
|
||||
2. When `isError: true`, the SDK wraps results in a JSON-RPC error envelope (`{"error":{"code":-32603,...}}`) rather than a success result.
|
||||
|
||||
Status: ✅ Complete
|
||||
|
||||
### Task 5.4 - Normalize MCP tool error formatting (NEXT)
|
||||
|
||||
Reference in New Issue
Block a user