Skip to main content
Glama

kobold_last_logprobs

Retrieve token log probabilities from the most recent text generation request to analyze model confidence and token-level predictions.

Instructions

Get token logprobs from the last request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiUrlNohttp://localhost:5001

Implementation Reference

  • Handler dispatch table mapping 'kobold_last_logprobs' to endpoint '/api/extra/last_logprobs' and execution logic that proxies POST requests to the KoboldAI API after schema validation.
    const postEndpoints: Record<string, { endpoint: string; schema: z.ZodTypeAny }> = {
        kobold_multiplayer_status: { endpoint: '/api/extra/multiplayer/status', schema: MultiplayerStatusSchema },
        kobold_multiplayer_get_story: { endpoint: '/api/extra/multiplayer/getstory', schema: MultiplayerGetStorySchema },
        kobold_multiplayer_set_story: { endpoint: '/api/extra/multiplayer/setstory', schema: MultiplayerSetStorySchema },
        kobold_generate_check_multiuser: { endpoint: '/api/extra/generate/check', schema: GenerateCheckMultiuserSchema },
        kobold_generate: { endpoint: '/api/v1/generate', schema: GenerateSchema },
        kobold_token_count: { endpoint: '/api/extra/tokencount', schema: TokenCountSchema },
        kobold_detokenize: { endpoint: '/api/extra/detokenize', schema: DetokenizeSchema },
        kobold_transcribe: { endpoint: '/api/extra/transcribe', schema: TranscribeSchema },
        kobold_web_search: { endpoint: '/api/extra/websearch', schema: WebSearchSchema },
        kobold_tts: { endpoint: '/api/extra/tts', schema: TTSSchema },
        kobold_abort: { endpoint: '/api/extra/abort', schema: AbortSchema },
        kobold_last_logprobs: { endpoint: '/api/extra/last_logprobs', schema: LastLogProbsSchema },
        kobold_txt2img: { endpoint: '/sdapi/v1/txt2img', schema: Txt2ImgSchema },
        kobold_img2img: { endpoint: '/sdapi/v1/img2img', schema: Img2ImgSchema },
        kobold_interrogate: { endpoint: '/sdapi/v1/interrogate', schema: InterrogateSchema },
        kobold_complete: { endpoint: '/v1/completions', schema: CompletionSchema },
    };
    
    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,
        };
  • BaseConfigSchema defining the common apiUrl parameter, used by LastLogProbsSchema for input validation.
    const BaseConfigSchema = z.object({
        apiUrl: z.string().default('http://localhost:5001'),
    });
  • LastLogProbsSchema definition, aliasing BaseConfigSchema for the tool's input schema.
    const LastLogProbsSchema = BaseConfigSchema;
  • src/index.ts:228-232 (registration)
    Registration of the 'kobold_last_logprobs' tool in the ListTools response, specifying name, description, and input schema.
    {
        name: "kobold_last_logprobs",
        description: "Get token logprobs from the last request",
        inputSchema: zodToJsonSchema(LastLogProbsSchema),
    },
  • makeRequest helper function that performs the HTTP request proxying to the KoboldAI backend, used by the tool handler.
    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 of behavioral disclosure. It states the action but doesn't explain what 'token logprobs' are, whether this is a read-only operation, if it requires a prior request, or any performance implications. This leaves significant gaps in understanding the tool's behavior.

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 with no wasted words, making it highly concise and front-loaded. Every word contributes directly to stating the tool's purpose, earning its place efficiently.

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 complexity of token logprobs in AI contexts, no annotations, no output schema, and low schema coverage, the description is insufficient. It doesn't explain the return format, prerequisites (e.g., needing a prior request), or how this fits with sibling tools, leaving the agent with incomplete context for effective use.

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 input schema has only one parameter ('apiUrl') with 0% description coverage, and the description doesn't mention parameters at all. Since there are zero parameters documented in the description, this meets the baseline of 4 for minimal parameter burden, but it doesn't add value beyond the schema's limited information.

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 ('token logprobs from the last request'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'kobold_complete' or 'kobold_generate' that might also involve token processing, which prevents 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, such as whether it's for debugging, analysis, or specific contexts. With many sibling tools like 'kobold_complete' and 'kobold_generate' that might overlap in token-related tasks, this lack of differentiation 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