Skip to main content
Glama

kobold_detokenize

Convert token IDs into readable text using the Kobold MCP Server. Ideal for decoding processed token data into clear, human-readable output.

Instructions

Convert token IDs to text

Input Schema

NameRequiredDescriptionDefault
apiUrlNohttp://localhost:5001
tokensYes

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "apiUrl": { "default": "http://localhost:5001", "type": "string" }, "tokens": { "items": { "type": "number" }, "type": "array" } }, "required": [ "tokens" ], "type": "object" }

Implementation Reference

  • Generic handler logic for POST endpoint tools like kobold_detokenize: validates arguments using the tool's schema, proxies POST request to the KoboldAI API endpoint, and returns the JSON 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 definition for kobold_detokenize tool inputs: optional apiUrl and required tokens array of numbers.
    const DetokenizeSchema = BaseConfigSchema.extend({ tokens: z.array(z.number()), });
  • src/index.ts:203-207 (registration)
    Registers kobold_detokenize in the list of available tools returned by ListToolsRequestHandler, including name, description, and input schema.
    { name: "kobold_detokenize", description: "Convert token IDs to text", inputSchema: zodToJsonSchema(DetokenizeSchema), },
  • src/index.ts:334-334 (registration)
    Maps the kobold_detokenize tool name to its corresponding KoboldAI API endpoint and schema in the postEndpoints lookup object used by the CallTool handler.
    kobold_detokenize: { endpoint: '/api/extra/detokenize', schema: DetokenizeSchema },
  • Helper function used by all proxy tools, including kobold_detokenize, to make HTTP 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(); }

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