kobold_detokenize
Convert token IDs to readable text for processing AI-generated content in KoboldAI integrations.
Instructions
Convert token IDs to text
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiUrl | No | http://localhost:5001 | |
| tokens | Yes |
Implementation Reference
- src/index.ts:346-357 (handler)Handler logic for POST-based tools like kobold_detokenize: validates input with schema, proxies POST request to KoboldAI API endpoint, returns JSON response.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, };
- src/index.ts:50-52 (schema)Zod schema defining input for kobold_detokenize: optional apiUrl and array of token numbers.const DetokenizeSchema = BaseConfigSchema.extend({ tokens: z.array(z.number()), });
- src/index.ts:203-207 (registration)MCP tool registration in listTools response, providing name, description, and input schema.{ name: "kobold_detokenize", description: "Convert token IDs to text", inputSchema: zodToJsonSchema(DetokenizeSchema), },
- src/index.ts:334-334 (registration)Internal dispatch registration mapping tool name to KoboldAI endpoint and schema for proxying.kobold_detokenize: { endpoint: '/api/extra/detokenize', schema: DetokenizeSchema },