Skip to main content
Glama
Ichigo3766

Image Generation MCP Server

by Ichigo3766

set_sd_model

Define the active Stable Diffusion model for text-to-image generation and image upscaling within the Image Generation MCP Server by specifying the model name.

Instructions

Set the active Stable Diffusion model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
model_nameYesName of the model to set as active

Implementation Reference

  • The handler function for the 'set_sd_model' tool. It validates the input arguments using isSetModelArgs, then sends a POST request to the Stable Diffusion WebUI API endpoint '/sdapi/v1/options' to set the active model checkpoint using the provided model_name, and returns a confirmation message.
    case 'set_sd_model': {
      const args = request.params.arguments;
      if (!isSetModelArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid parameters');
      }
    
      await this.axiosInstance.post('/sdapi/v1/options', {
        sd_model_checkpoint: args.model_name
      });
    
      return { content: [{ type: 'text', text: `Model set to: ${args.model_name}` }] };
    }
  • src/index.ts:181-191 (registration)
    The registration of the 'set_sd_model' tool in the list of tools provided by the ListToolsRequestHandler. Includes the tool name, description, and input schema definition.
    {
      name: 'set_sd_model',
      description: 'Set the active Stable Diffusion model',
      inputSchema: {
        type: 'object',
        properties: {
          model_name: { type: 'string', description: 'Name of the model to set as active' }
        },
        required: ['model_name']
      }
    },
  • TypeScript interface defining the expected input arguments for the set_sd_model tool.
    interface SetModelArgs {
      model_name: string;
    }
  • Helper function to validate and type-guard the input arguments for the set_sd_model tool, ensuring model_name is a string.
    function isSetModelArgs(value: unknown): value is SetModelArgs {
      if (typeof value !== 'object' || value === null) return false;
      const v = value as Record<string, unknown>;
      return typeof v.model_name === 'string';
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool sets the active model, implying a mutation operation, but doesn't describe any behavioral traits such as whether changes are persistent, if it requires specific permissions, potential side effects on other tools, or error conditions. This leaves significant gaps for an agent to understand how to use it safely and effectively.

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 a single, direct sentence with zero wasted words. It front-loads the essential information ('Set the active Stable Diffusion model'), making it highly efficient and easy to parse. Every word earns its place.

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

Completeness3/5

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

Given the tool's moderate complexity (a mutation operation with one parameter) and the absence of annotations and output schema, the description is minimally adequate. It states what the tool does but lacks context on behavior, usage, and relationships with sibling tools. Without annotations or output schema, more detail would be beneficial, but it meets a basic threshold.

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

Parameters3/5

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

The input schema has 100% description coverage, with the single parameter 'model_name' clearly documented. The description adds no additional meaning beyond what the schema provides, such as examples of valid model names or constraints. According to the rules, when schema coverage is high (>80%), the baseline score is 3 even with no param info in the description.

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

Purpose4/5

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

The description clearly states the action ('Set') and the target resource ('active Stable Diffusion model'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from its siblings like 'get_sd_models' or 'generate_image', which would require mentioning it's for configuration rather than generation or retrieval.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing to know available models from 'get_sd_models'), exclusions, or how it relates to sibling tools like 'generate_image' (which might use the active model). Usage is implied but not explicitly stated.

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

Related 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/Ichigo3766/image-gen-mcp'

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