Fix debug logging

This commit is contained in:
Colin McDonnell
2025-12-17 10:44:49 -08:00
parent 361bd1502f
commit 53f6f18352
6 changed files with 88 additions and 174 deletions
+14 -15
View File
@@ -1,24 +1,23 @@
import { type } from "arktype";
import type { Context } from "../main.ts";
import { $ } from "../utils/shell.ts";
import { handleToolError, handleToolSuccess, tool, type ToolResult } from "./shared.ts";
import { execute, 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 {
export function DebugShellCommandTool(_ctx: Context) {
return 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: execute(_ctx, async () => {
const result = $("git", ["status"]);
return handleToolSuccess({
return {
success: true,
command: "git status",
output: result.trim(),
});
} catch (error) {
return handleToolError(error);
}
},
});
};
}),
});
}