Skip to main content
Glama

kobold_max_context_length

Retrieve the maximum context length setting from KoboldAI's text generation server to manage input size for optimal performance.

Instructions

Get current max context length setting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiUrlNohttp://localhost:5001

Implementation Reference

  • Handler logic that executes the tool: performs a GET request to the KoboldAI API endpoint '/api/v1/config/max_context_length' and returns the JSON response as text content.
    if (getEndpoints[name]) {
        const result = await makeRequest(`${apiUrl}${getEndpoints[name]}`);
        return {
            content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
            isError: false,
        };
  • Zod schema definition for tool input (optional apiUrl), referenced as MaxContextLengthSchema and converted to JSON schema in registration.
    const BaseConfigSchema = z.object({
        apiUrl: z.string().default('http://localhost:5001'),
    });
    
    // Core API schemas (api/v1)
    const MaxContextLengthSchema = BaseConfigSchema;
  • src/index.ts:167-171 (registration)
    Tool registration in the ListTools response, specifying name, description, and input schema.
    {
        name: "kobold_max_context_length",
        description: "Get current max context length setting",
        inputSchema: zodToJsonSchema(MaxContextLengthSchema),
    },
  • Dispatch table mapping tool name to the corresponding KoboldAI GET endpoint.
    const getEndpoints: Record<string, string> = {
        kobold_max_context_length: '/api/v1/config/max_context_length',
        kobold_max_length: '/api/v1/config/max_length',
        kobold_generate_check: '/api/extra/generate/check',
        kobold_model_info: '/api/v1/model',
        kobold_version: '/api/v1/info/version',
        kobold_perf_info: '/api/extra/perf',
        kobold_sd_models: '/sdapi/v1/sd-models',
        kobold_sd_samplers: '/sdapi/v1/samplers',
    };
  • Generic HTTP request helper function used by the tool handler to proxy requests to the KoboldAI 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();
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states this is a 'Get' operation, implying it's read-only, but doesn't disclose behavioral traits like authentication needs, rate limits, or what the return value looks like (e.g., a numeric value or structured data). This is a significant gap for a tool with no annotation coverage.

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 a single, clear sentence that front-loads the essential information ('Get current max context length setting') with zero wasted words. It's appropriately sized for a simple retrieval tool.

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 low complexity (1 optional parameter, no output schema, no annotations), the description is incomplete. It doesn't explain the return value (e.g., what format the 'max context length' is in), which is critical for an agent to use the tool effectively. Without annotations or output schema, more context is needed.

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

Parameters4/5

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

The description adds no parameter information beyond the input schema, which has 1 parameter with 0% schema description coverage. However, since there's only 1 optional parameter ('apiUrl'), the tool's core function doesn't rely on parameters, so the description adequately covers the semantics without needing to detail parameters. This justifies a score above the baseline.

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

Purpose4/5

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

The description clearly states the action ('Get') and the resource ('current max context length setting'), making the purpose understandable. It doesn't explicitly differentiate from sibling tools like 'kobold_max_length' or 'kobold_model_info', which might provide related settings, so it falls short of a perfect score.

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. With siblings like 'kobold_max_length' (which might handle a different max length parameter) and 'kobold_model_info' (which could include context info), there's no indication of when this specific tool is appropriate, leaving the agent to guess.

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