kobold_web_search
Perform web searches using DuckDuckGo to retrieve real-time information, enabling seamless integration with KoboldAI for enhanced text generation and MCP-compatible applications.
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:346-357 (handler)Core handler logic for all POST-based tools including kobold_web_search: looks up endpoint and schema from dispatch table, validates input, proxies the POST request to the KoboldAI /api/extra/websearch endpoint, and returns the 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:59-61 (schema)Zod schema defining input for kobold_web_search: optional apiUrl and required query string.const WebSearchSchema = BaseConfigSchema.extend({ query: z.string(), });
- src/index.ts:213-217 (registration)Registers kobold_web_search in the list of available tools returned by ListToolsRequest, including name, description, and input schema.{ name: "kobold_web_search", description: "Search the web via DuckDuckGo", inputSchema: zodToJsonSchema(WebSearchSchema), },
- src/index.ts:336-336 (helper)Dispatch table mapping for kobold_web_search tool: specifies the KoboldAI API endpoint '/api/extra/websearch' and validation schema.kobold_web_search: { endpoint: '/api/extra/websearch', schema: WebSearchSchema },
- src/index.ts:146-162 (helper)Shared helper function used by all proxy tools, including kobold_web_search, to make HTTP requests to the KoboldAI backend 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(); }