Skip to main content
Glama

kobold_img2img

Modify an existing image using text prompts with stable diffusion integration. Adjust parameters like dimensions, steps, and denoising strength for precise transformations.

Instructions

Transform existing image using prompt

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiUrlNohttp://localhost:5001
cfg_scaleNo
denoising_strengthNo
heightNo
init_imagesYes
negative_promptNo
promptYes
sampler_nameNo
seedNo
stepsNo
widthNo

Implementation Reference

  • Shared handler logic for all POST-based tools, including 'kobold_img2img'. Validates input against the tool's schema, then proxies the request to the KoboldAI API endpoint '/sdapi/v1/img2img'.
    if (postEndpoints[name]) { const { endpoint, schema } = postEndpoints[name]; const parsed = schema.safeParse(args); if (!parsed.success) { throw new Error(`Invalid arguments: ${parsed.error}`); } const result = await makeRequest(`${apiUrl}${endpoint}`, 'POST', requestData); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], isError: false, };
  • Zod schema defining the input parameters for the 'kobold_img2img' tool, extending Txt2ImgSchema with required init_images array and optional denoising_strength.
    const Img2ImgSchema = Txt2ImgSchema.extend({ init_images: z.array(z.string()), denoising_strength: z.number().optional(), });
  • src/index.ts:249-253 (registration)
    Registration of the 'kobold_img2img' tool in the list of available tools returned by ListToolsRequest.
    { name: "kobold_img2img", description: "Transform existing image using prompt", inputSchema: zodToJsonSchema(Img2ImgSchema), },
  • src/index.ts:341-341 (registration)
    Mapping of tool name 'kobold_img2img' to its API endpoint and schema in the postEndpoints dispatch table.
    kobold_img2img: { endpoint: '/sdapi/v1/img2img', schema: Img2ImgSchema },
  • Utility function used by all tool handlers to make HTTP requests to the KoboldAI backend API.
    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