Skip to main content
Glama

kobold_sd_models

Retrieve available Stable Diffusion models from KoboldAI's MCP server for AI image generation tasks.

Instructions

List available Stable Diffusion models

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiUrlNohttp://localhost:5001

Implementation Reference

  • Handler for kobold_sd_models and other GET tools: maps to '/sdapi/v1/sd-models' endpoint and proxies the request via makeRequest, returning the JSON response.
    const getEndpoints: Record<string, string> = {
        kobold_max_context_length: '/api/v1/config/max_context_length',
        kobold_max_length: '/api/v1/config/max_length',
        kobold_generate_check: '/api/extra/generate/check',
        kobold_model_info: '/api/v1/model',
        kobold_version: '/api/v1/info/version',
        kobold_perf_info: '/api/extra/perf',
        kobold_sd_models: '/sdapi/v1/sd-models',
        kobold_sd_samplers: '/sdapi/v1/samplers',
    };
    
    if (getEndpoints[name]) {
        const result = await makeRequest(`${apiUrl}${getEndpoints[name]}`);
        return {
            content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
            isError: false,
        };
    }
  • src/index.ts:235-238 (registration)
    Tool registration in ListTools response, specifying name, description, and inputSchema.
        name: "kobold_sd_models",
        description: "List available Stable Diffusion models",
        inputSchema: zodToJsonSchema(SDModelsSchema),
    },
  • Input schema for kobold_sd_models tool, equivalent to BaseConfigSchema (optional apiUrl).
    const SDModelsSchema = BaseConfigSchema;
  • BaseConfigSchema used by SDModelsSchema and all tools, allowing optional apiUrl override.
    const BaseConfigSchema = z.object({
        apiUrl: z.string().default('http://localhost:5001'),
    });
  • Shared helper function makeRequest used to proxy all API calls, including for kobold_sd_models.
    async function makeRequest(url: string, method = 'GET', body: Record<string, unknown> | null = null) {
        const options: RequestInit = {
            method,
            headers: body ? { 'Content-Type': 'application/json' } : undefined,
        };
        
        if (body && method !== 'GET') {
            options.body = JSON.stringify(body);
        }
    
        const response = await fetch(url, options);
        if (!response.ok) {
            throw new Error(`KoboldAI API error: ${response.statusText}`);
        }
        
        return response.json();
    }

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/PhialsBasement/KoboldCPP-MCP-Server'

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