feat: register remaining MCP tools
This commit is contained in:
+100
@@ -2,6 +2,10 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
||||
import { baseInputSchema } from "./tools/schemas.js";
|
||||
import { handleAskChatGpt } from "./tools/ask-chatgpt.js";
|
||||
import { handleReviewPlan } from "./tools/review-plan.js";
|
||||
import { handleReviewCode } from "./tools/review-code.js";
|
||||
import { handleDebugIssue } from "./tools/debug-issue.js";
|
||||
import { handleArchitectureReview } from "./tools/architecture-review.js";
|
||||
import { loadConfig } from "./config/env.js";
|
||||
import { createOpenAIClient } from "./openai/client.js";
|
||||
import { sendOpenAIResponse } from "./openai/responses.js";
|
||||
@@ -35,4 +39,100 @@ server.registerTool(
|
||||
}
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
"review_plan",
|
||||
{
|
||||
description:
|
||||
"Review a proposed implementation plan before acting. Looks for missing steps, unsafe assumptions, scope creep, sequencing, test gaps.",
|
||||
inputSchema: baseInputSchema,
|
||||
},
|
||||
async (input) => {
|
||||
const result = await handleReviewPlan(input, {
|
||||
loadConfig,
|
||||
createOpenAIClient,
|
||||
sendOpenAIResponse,
|
||||
});
|
||||
|
||||
return {
|
||||
content: [
|
||||
{ type: "text", text: result.ok ? result.answer : `Error: ${result.error}` },
|
||||
],
|
||||
isError: !result.ok,
|
||||
warnings: result.warnings?.length ? result.warnings : undefined,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
"review_code",
|
||||
{
|
||||
description:
|
||||
"Review focused code snippets, patches, or diffs. Looks for correctness, bugs, maintainability, security issues, tests, simpler approaches.",
|
||||
inputSchema: baseInputSchema,
|
||||
},
|
||||
async (input) => {
|
||||
const result = await handleReviewCode(input, {
|
||||
loadConfig,
|
||||
createOpenAIClient,
|
||||
sendOpenAIResponse,
|
||||
});
|
||||
|
||||
return {
|
||||
content: [
|
||||
{ type: "text", text: result.ok ? result.answer : `Error: ${result.error}` },
|
||||
],
|
||||
isError: !result.ok,
|
||||
warnings: result.warnings?.length ? result.warnings : undefined,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
"debug_issue",
|
||||
{
|
||||
description:
|
||||
"Analyse errors, logs, failed tests, or stack traces. Looks for root causes, fast checks, minimal safe experiments, what not to change yet.",
|
||||
inputSchema: baseInputSchema,
|
||||
},
|
||||
async (input) => {
|
||||
const result = await handleDebugIssue(input, {
|
||||
loadConfig,
|
||||
createOpenAIClient,
|
||||
sendOpenAIResponse,
|
||||
});
|
||||
|
||||
return {
|
||||
content: [
|
||||
{ type: "text", text: result.ok ? result.answer : `Error: ${result.error}` },
|
||||
],
|
||||
isError: !result.ok,
|
||||
warnings: result.warnings?.length ? result.warnings : undefined,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
"architecture_review",
|
||||
{
|
||||
description:
|
||||
"Review architecture decisions and trade-offs. Looks at local vs cloud simplicity, maintainability, operational risk, vendor lock-in, future extension paths.",
|
||||
inputSchema: baseInputSchema,
|
||||
},
|
||||
async (input) => {
|
||||
const result = await handleArchitectureReview(input, {
|
||||
loadConfig,
|
||||
createOpenAIClient,
|
||||
sendOpenAIResponse,
|
||||
});
|
||||
|
||||
return {
|
||||
content: [
|
||||
{ type: "text", text: result.ok ? result.answer : `Error: ${result.error}` },
|
||||
],
|
||||
isError: !result.ok,
|
||||
warnings: result.warnings?.length ? result.warnings : undefined,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
await server.connect(new StdioServerTransport());
|
||||
|
||||
Reference in New Issue
Block a user