Skip to main content
Glama

qwen3_code_fix

Fix bugs in code by analyzing error messages and providing corrected solutions for various programming languages.

Instructions

Fix bugs in code using Qwen3-Coder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe buggy code to fix
errorNoError message or description of the bug
languageNoProgramming language of the code

Implementation Reference

  • Switch case handling the 'qwen3_code_fix' tool call: constructs a detailed prompt including the buggy code, optional error message, and language, then invokes the callQwen3Coder helper to execute the model inference.
    case "qwen3_code_fix": prompt = `Fix the following ${args.language || 'code'} that has a bug: \`\`\`${args.language || ''} ${args.code} \`\`\` ${args.error ? `Error/Issue: ${args.error}` : ''} Please provide the corrected code with explanations of what was wrong and how it was fixed.`; result = await callQwen3Coder(prompt); break;
  • Registration of the 'qwen3_code_fix' tool in the ListTools response, including name, description, and input schema defining parameters: code (required), error, language.
    { name: "qwen3_code_fix", description: "Fix bugs in code using Qwen3-Coder", inputSchema: { type: "object", properties: { code: { type: "string", description: "The buggy code to fix" }, error: { type: "string", description: "Error message or description of the bug" }, language: { type: "string", description: "Programming language of the code" } }, required: ["code"] } },
  • Input schema for the 'qwen3_code_fix' tool, specifying an object with 'code' (string, required), 'error' (string, optional), and 'language' (string, optional).
    inputSchema: { type: "object", properties: { code: { type: "string", description: "The buggy code to fix" }, error: { type: "string", description: "Error message or description of the bug" }, language: { type: "string", description: "Programming language of the code" } }, required: ["code"] }
  • Core helper function that executes the Qwen3-Coder model via Ollama by spawning a child process with the given prompt, capturing stdout/stderr, handling timeout, and resolving with the model's output.
    async function callQwen3Coder(prompt, options = {}) { return new Promise((resolve, reject) => { const ollamaProcess = spawn('ollama', ['run', 'qwen3-coder:30b', prompt], { stdio: ['pipe', 'pipe', 'pipe'] }); let output = ''; let error = ''; ollamaProcess.stdout.on('data', (data) => { output += data.toString(); }); ollamaProcess.stderr.on('data', (data) => { error += data.toString(); }); ollamaProcess.on('close', (code) => { if (code === 0) { resolve(output.trim()); } else { reject(new Error(`Ollama process exited with code ${code}: ${error}`)); } }); // Set timeout for long-running requests setTimeout(() => { ollamaProcess.kill(); reject(new Error('Request timeout')); }, options.timeout || 120000); // 2 minutes default timeout }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/keithah/qwen3-coder-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server