Skip to main content
Glama

kobold_chat

Generate text responses using KoboldAI's chat completion capabilities through an OpenAI-compatible API interface for conversational AI applications.

Instructions

Chat completion (OpenAI-compatible)

Input Schema

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

Implementation Reference

  • Implementation of the kobold_chat tool handler: appends incoming messages to in-memory chat history, sends full history to KoboldAI /v1/chat/completions endpoint (overriding with full history), adds response to history, and returns the API response as text.
    if (name === 'kobold_chat') {
        // Add new messages to chat history
        const newMessages = (requestData as any).messages || [];
        chatHistory.push(...newMessages);
    
        // Get last 4 messages
        const recentMessages = chatHistory.slice(-4);
        console.error('Last 4 messages in chat:');
        console.error(JSON.stringify(recentMessages, null, 2));
    
        // Make the API request with all context
        const result = await makeRequest(
            `${apiUrl}/v1/chat/completions`,
            'POST',
            { ...requestData, messages: chatHistory }
        );
    
        // Add assistant's response to history
        const typedResult = result as any;
        if (typedResult.choices?.[0]?.message) {
            chatHistory.push(typedResult.choices[0].message);
        }
    
        return {
            content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
            isError: false,
        };
    }
  • Zod input schema for kobold_chat tool: OpenAI-compatible chat completion parameters including messages array and optional sampling params.
    const ChatCompletionSchema = BaseConfigSchema.extend({
        messages: z.array(z.object({
            role: z.enum(['system', 'user', 'assistant']),
            content: z.string(),
        })),
        temperature: z.number().optional(),
        top_p: z.number().optional(),
        max_tokens: z.number().optional(),
        stop: z.array(z.string()).optional(),
    });
  • src/index.ts:260-264 (registration)
    Registration of the kobold_chat tool in the ListTools response, referencing its schema.
    {
        name: "kobold_chat",
        description: "Chat completion (OpenAI-compatible)",
        inputSchema: zodToJsonSchema(ChatCompletionSchema),
    },
  • Global in-memory chat history array used exclusively by the kobold_chat handler to maintain conversation context.
    const chatHistory: Array<{
        role: 'system' | 'user' | 'assistant',
        content: string
    }> = [];
    // Generate check schemas
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool is for 'chat completion' and 'OpenAI-compatible,' which implies it generates text responses in a conversational format, but it lacks details on behavioral traits like rate limits, authentication needs, response format, or any side effects. This is a significant gap for a tool with multiple parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just 'Chat completion (OpenAI-compatible)', which is front-loaded and wastes no words. Every part of the sentence contributes to the tool's identity, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 parameters, no annotations, no output schema), the description is incomplete. It doesn't cover behavioral aspects, parameter usage, or output expectations, leaving gaps that could hinder an AI agent's ability to invoke the tool correctly. The brevity doesn't compensate for the lack of necessary details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate by explaining parameters. However, it adds no meaning beyond the schema—it doesn't clarify what 'apiUrl' defaults to, how 'messages' should be structured for chat, or the effects of 'temperature' and other settings. With 6 parameters and no param info in the description, it fails to provide necessary context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Chat completion (OpenAI-compatible)' states the tool's function as a chat completion service and mentions compatibility, which gives a general purpose. However, it's vague about what 'chat completion' specifically entails (e.g., generating responses in a conversation) and doesn't clearly distinguish it from sibling tools like kobold_generate or kobold_complete, which might have overlapping functionalities. It avoids tautology by not just repeating the name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any context, prerequisites, or exclusions, such as when to choose kobold_chat over kobold_generate or other siblings for chat-like interactions. This leaves the agent without clear usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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