add debug mcp tool for testing, fix transport issues

This commit is contained in:
Colin McDonnell
2025-11-25 17:07:40 -08:00
parent 106de07802
commit 4ff547f673
7 changed files with 67 additions and 6 deletions
+45
View File
@@ -0,0 +1,45 @@
import { type } from "arktype";
import { $ } from "../utils/shell.ts";
import type { ToolResult } from "./shared.ts";
import { tool } from "./shared.ts";
export const DebugShellCommand = type({});
export const DebugShellCommandTool = tool({
name: "debug_shell_command",
description:
"debug tool: runs 'git status' and returns the output. use this to test shell command execution in the MCP server.",
parameters: DebugShellCommand,
execute: async (): Promise<ToolResult> => {
try {
const result = $("git", ["status"]);
return {
content: [
{
type: "text",
text: JSON.stringify(
{
success: true,
command: "git status",
output: result.trim(),
},
null,
2
),
},
],
};
} catch (error) {
return {
content: [
{
type: "text",
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
},
],
isError: true,
};
}
},
});
+2
View File
@@ -9,6 +9,7 @@ import {
EditCommentTool,
UpdateWorkingCommentTool,
} from "./comment.ts";
import { DebugShellCommandTool } from "./debug.ts";
import { IssueTool } from "./issue.ts";
import { PullRequestTool } from "./pr.ts";
import { PullRequestInfoTool } from "./prInfo.ts";
@@ -35,6 +36,7 @@ addTools(server, [
GetReviewCommentsTool,
ListPullRequestReviewsTool,
GetCheckSuiteLogsTool,
DebugShellCommandTool,
]);
server.start();