Skip to main content
Glama

kobold_generate

Generate text content using KoboldAI's language model by providing prompts and adjusting parameters like length, temperature, and context.

Instructions

Generate text with KoboldAI

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiUrlNohttp://localhost:5001
promptYes
max_lengthNo
max_context_lengthNo
temperatureNo
top_pNo
top_kNo
repetition_penaltyNo
stop_sequenceNo
seedNo

Implementation Reference

  • Handler logic for POST-based tools like kobold_generate: validates arguments using the tool's schema, then forwards the request via HTTP POST to the specified KoboldAI API endpoint and returns the JSON response.
    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_generate tool, including prompt and various generation options.
    const GenerateSchema = BaseConfigSchema.extend({ prompt: z.string(), max_length: z.number().optional(), max_context_length: z.number().optional(), temperature: z.number().optional(), top_p: z.number().optional(), top_k: z.number().optional(), repetition_penalty: z.number().optional(), stop_sequence: z.array(z.string()).optional(), seed: z.number().optional(), });
  • src/index.ts:177-181 (registration)
    Tool registration in the listTools response, specifying name, description, and input schema.
    { name: "kobold_generate", description: "Generate text with KoboldAI", inputSchema: zodToJsonSchema(GenerateSchema), },
  • src/index.ts:332-332 (registration)
    Endpoint mapping for kobold_generate in the POST dispatch table, linking tool name to API path and schema.
    kobold_generate: { endpoint: '/api/v1/generate', schema: GenerateSchema },
  • Helper function that performs HTTP requests to the KoboldAI API, used by the tool handlers.
    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