Skip to main content
Glama

kobold_complete

Generate text completions using OpenAI-compatible API endpoints. Input a prompt, adjust parameters like max_tokens and temperature, and receive AI-generated responses for diverse applications.

Instructions

Text completion (OpenAI-compatible)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiUrlNohttp://localhost:5001
max_tokensNo
promptYes
stopNo
temperatureNo
top_pNo

Implementation Reference

  • Generic handler logic for all POST endpoint tools, including "kobold_complete". It validates the input arguments using the tool's schema, makes a POST request to the KoboldAI API endpoint, and returns the response as text content.
    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_complete" tool, extending BaseConfigSchema with OpenAI-compatible completion parameters.
    const CompletionSchema = BaseConfigSchema.extend({ prompt: z.string(), max_tokens: z.number().optional(), temperature: z.number().optional(), top_p: z.number().optional(), stop: z.array(z.string()).optional(), });
  • src/index.ts:265-269 (registration)
    Registers the "kobold_complete" tool in the ListTools response, providing its name, description, and input schema.
    { name: "kobold_complete", description: "Text completion (OpenAI-compatible)", inputSchema: zodToJsonSchema(CompletionSchema), },
  • Helper function used by the tool handlers to perform HTTP requests to the KoboldAI API server.
    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(); }
  • Dispatch mapping for "kobold_complete" tool to its API endpoint '/v1/completions' and validation schema.
    kobold_complete: { endpoint: '/v1/completions', schema: CompletionSchema }, };

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