UNPKG

@ldavis9000aws/swarmui-generator

Version:

A Model Context Protocol server for SwarmUI image generation with TypeScript

56 lines 2.17 kB
/** * List Schedulers MCP Tool * * This file contains the MCP tool definition for listing available scheduler algorithms. */ /** * Input schema for the list_schedulers tool. */ export const listSchedulersSchema = { description: 'Lists all available sampler or scheduler algorithms from the SwarmUI server. Schedulers control the denoising process during image generation and can affect the final image style, quality, and speed. This tool helps identify which schedulers can be specified when using the "generate_images" tool. No parameters are required.', type: 'object', properties: {}, required: [] }; /** * Handler for the list_schedulers tool */ export async function listSchedulersHandler(params, swarmui) { try { const schedulers = await swarmui.listSchedulers(); if (schedulers.length === 0) { return { content: [{ type: 'text', text: 'No schedulers are currently available on the SwarmUI server.' }], _meta: { schedulerCount: 0 } }; } let resultText = `Available Schedulers/Samplers (${schedulers.length}):\n\n`; schedulers.forEach(scheduler => { resultText += `- Name: ${scheduler.Name}\n`; resultText += ` Display Name: ${scheduler.FormattedName || scheduler.Name}\n`; if (scheduler.Description) resultText += ` Description: ${scheduler.Description}\n`; resultText += `\n`; }); return { content: [{ type: 'text', text: resultText.trim() }], _meta: { schedulerCount: schedulers.length } }; } catch (error) { return { content: [{ type: 'text', text: `Error listing schedulers: ${error instanceof Error ? error.message : String(error)}` }], isError: true, _meta: { error: error instanceof Error ? error.message : String(error) } }; } } //# sourceMappingURL=list-schedulers.js.map