kobold_interrogate
Generate descriptive captions for images using AI analysis to identify content, objects, and scenes automatically.
Instructions
Generate caption for image
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiUrl | No | http://localhost:5001 | |
| image | Yes |
Implementation Reference
- src/index.ts:93-95 (schema)Zod schema for input validation of the kobold_interrogate tool. Extends BaseConfigSchema with a required 'image' field (base64 encoded image). Used for both tool registration and request validation.const InterrogateSchema = BaseConfigSchema.extend({ image: z.string(), });
- src/index.ts:254-258 (registration)Registers the kobold_interrogate tool in the ListTools response, providing name, description, and input schema.{ name: "kobold_interrogate", description: "Generate caption for image", inputSchema: zodToJsonSchema(InterrogateSchema), },
- src/index.ts:342-342 (registration)Maps the kobold_interrogate tool name to its KoboldAI API endpoint '/sdapi/v1/interrogate' and validation schema within the POST endpoints dispatch table.kobold_interrogate: { endpoint: '/sdapi/v1/interrogate', schema: InterrogateSchema },
- src/index.ts:346-357 (handler)Core handler logic for kobold_interrogate (and other POST tools): parses input with schema, forwards POST request to apiUrl + endpoint with arguments, returns 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, };
- src/index.ts:146-162 (helper)Utility function used by the handler to perform HTTP requests to the KoboldAI backend API, handling JSON serialization and error checking.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(); }