Skip to main content
Glama

switch_model

Switch the active Whisper model for the current session without restarting. Accepts a model filename or full path. Model must be installed in the models directory.

Instructions

Switch the active Whisper model for the current session without restarting Claude Desktop. Accepts a model filename (e.g. ggml-large-v3-turbo.bin) or full path. The model must already be installed in your models directory. Use list_models to see installed models, download_model to add new ones. Change is session-scoped — does not persist after Claude Desktop restarts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
model_nameYesModel filename (e.g. ggml-large-v3-turbo.bin) or full path. Must be a .bin file in the configured models directory.

Implementation Reference

  • src/index.ts:1107-1127 (registration)
    Tool registration/definition for switch_model in ListToolsRequestSchema handler. Defines name, description, and inputSchema (model_name required string ending in .bin).
        {
          name: "switch_model",
          description:
            "Switch the active Whisper model for the current session without restarting Claude Desktop. " +
            "Accepts a model filename (e.g. ggml-large-v3-turbo.bin) or full path. " +
            "The model must already be installed in your models directory. " +
            "Use list_models to see installed models, download_model to add new ones. " +
            "Change is session-scoped — does not persist after Claude Desktop restarts.",
          inputSchema: {
            type: "object",
            properties: {
              model_name: {
                type: "string",
                description: "Model filename (e.g. ggml-large-v3-turbo.bin) or full path. Must be a .bin file in the configured models directory.",
              },
            },
            required: ["model_name"],
          },
        },
      ],
    }));
  • Handler function for switch_model called via CallToolRequestSchema. Validates input (must end in .bin, no path traversal), resolves to full path within models directory, checks model file exists and no transcription is running, then updates the mutable WHISPER_MODEL variable.
    if (name === "switch_model") {
      const modelInput = (args?.model_name as string)?.trim();
      if (!modelInput) return { content: [{ type: "text", text: "model_name is required." }], isError: true };
    
      // Security: must end in .bin
      if (!modelInput.endsWith(".bin")) {
        return {
          content: [{ type: "text", text: `Invalid model: "${modelInput}"\nModel files must end in .bin` }],
          isError: true,
        };
      }
    
      // Security: reject path traversal
      if (UNSAFE_PATH_RE.test(modelInput)) {
        return {
          content: [{ type: "text", text: `Invalid path: "${modelInput}"\nPaths containing ".." or UNC paths are not allowed.` }],
          isError: true,
        };
      }
    
      // Resolve to full path — either absolute or relative to models dir
      const modelsDir = dirname(WHISPER_MODEL);
      const resolvedPath = modelInput.includes("\\") || modelInput.includes("/")
        ? modelInput
        : join(modelsDir, modelInput);
    
      // Security: must live within the configured models directory
      if (!resolvedPath.startsWith(modelsDir)) {
        return {
          content: [{ type: "text", text: `Security error: model must be within the configured models directory (${modelsDir}).` }],
          isError: true,
        };
      }
    
      if (!existsSync(resolvedPath)) {
        return {
          content: [{
            type: "text",
            text:
              `Model not found: ${resolvedPath}\n\n` +
              `Use list_models to see installed models, or download_model to install a new one.`,
          }],
          isError: true,
        };
      }
    
      // Process lock — don't switch mid-transcription
      if (await isWhisperRunning()) {
        return {
          content: [{ type: "text", text: "Cannot switch model while a transcription is in progress. Wait for the current job to finish first." }],
          isError: true,
        };
      }
    
      const previousModel = basename(WHISPER_MODEL);
      WHISPER_MODEL = resolvedPath;
      const newModel = basename(WHISPER_MODEL);
      const sizeMb = (statSync(resolvedPath).size / (1024 * 1024)).toFixed(0);
      const known = MODEL_REGISTRY.find(m => m.filename === newModel);
    
      return {
        content: [{
          type: "text",
          text:
            `✅ Model switched!\n\n` +
            `Previous: ${previousModel}\n` +
            `Active:   ${newModel} (${sizeMb} MB)\n` +
            (known ? `Use case: ${known.useCase}\n` : "") +
            `\nThis change is session-scoped. To make it permanent, update WHISPER_MODEL in claude_desktop_config.json.`,
        }],
      };
    }
  • Mutable WHISPER_MODEL variable declared using 'let' (not const) to allow runtime update by switch_model handler. Initialized from WHISPER_MODEL environment variable.
    let WHISPER_MODEL =
      process.env.WHISPER_MODEL ?? "C:\\whisper\\models\\ggml-base.en.bin";
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It reveals that the change is session-scoped and non-persistent, and that the model must already be installed. It lacks details about potential errors or side effects, but for a simple switch operation, this is adequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, highly informative, and front-loaded with the core action. Every word is necessary; there is no redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one required parameter, no output schema, no annotations), the description is comprehensive. It covers the purpose, prerequisites, scope, and related tools, leaving no gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% coverage for the single parameter, but the description adds context: it specifies the expected format (e.g., ggml-large-v3-turbo.bin), that it must be a .bin file, and that it can be a filename or full path. This adds value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Switch the active Whisper model'), the resource ('for the current session'), and the benefit ('without restarting Claude Desktop'). It distinguishes itself from sibling tools like list_models and download_model by specifying its unique function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly tells when to use the tool (to switch models without restart), prerequisites (model must be installed), scope (session only, not persistent), and references sibling tools (list_models, download_model) for related actions. This provides clear usage guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/eviscerations/whisper-windows-mcp'

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