kobold_web_search
Search the web using DuckDuckGo to find information for KoboldAI text generation tasks.
Instructions
Search the web via DuckDuckGo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiUrl | No | http://localhost:5001 | |
| query | Yes |
Implementation Reference
- src/index.ts:327-357 (handler)Handler for kobold_web_search: maps tool call to KoboldAI endpoint '/api/extra/websearch' via generic POST proxy using makeRequest, validates input with WebSearchSchema, returns JSON response.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, };
- src/index.ts:59-61 (schema)Zod schema for kobold_web_search input: extends BaseConfigSchema (apiUrl) with required 'query' string.const WebSearchSchema = BaseConfigSchema.extend({ query: z.string(), });
- src/index.ts:213-217 (registration)Tool registration in ListTools response: defines name, description, and inputSchema for kobold_web_search.{ name: "kobold_web_search", description: "Search the web via DuckDuckGo", inputSchema: zodToJsonSchema(WebSearchSchema), },
- src/index.ts:146-162 (helper)Utility function used by all proxy handlers, including kobold_web_search, to make HTTP requests to KoboldAI API.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(); }