Files
shockbot/mcp/debug.ts
T
Colin McDonnell 26336d0ac2 Tool factories
2025-12-15 23:04:20 -08:00

25 lines
750 B
TypeScript

import { type } from "arktype";
import { $ } from "../utils/shell.ts";
import { handleToolError, handleToolSuccess, tool, type ToolResult } 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 handleToolSuccess({
success: true,
command: "git status",
output: result.trim(),
});
} catch (error) {
return handleToolError(error);
}
},
});