Forked from soumyajit7038/python-tools
Project Files
src / tools / checkForBugs.ts
import { tool } from "@lmstudio/sdk";
import { z } from "zod";
import { checkPythonCodeForBugs } from "../utils/pythonBugChecker";
import { getToolDefinition } from "../utils/toolRegistry";
const TOOL_DEFINITION = getToolDefinition("check_for_bugs");
export const checkForBugsTool = tool({
name: TOOL_DEFINITION.name,
description:
`${TOOL_DEFINITION.description} This does not prove semantic correctness and does not execute your script normally.`,
parameters: {
code: z.string().min(1).max(50000).describe("Python source code to check."),
runPyCompile: z.boolean().optional().describe("Whether to run python -m py_compile (default true)."),
},
implementation: async ({ code, runPyCompile }) => {
return await checkPythonCodeForBugs({
code,
runPyCompile: runPyCompile ?? true,
});
},
});