ask_wiki
Get answers to questions by querying wiki content through RAG-powered search, enabling knowledge retrieval from documentation.
Instructions
Ask a question and get an answer based on wiki content using RAG.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| question | Yes |
Implementation Reference
- src/lib/handlers/smart.ts:88-102 (handler)The core execution logic for the 'ask_wiki' tool. Validates brain availability, performs RAG query via brain.ask, and formats response with answer and source links.async ask_wiki(args: { question: string }) { if (!brain.isEnabled()) { return { error: ERROR_MESSAGES.SMART_FEATURES_DISABLED }; } const { answer, sources } = await brain.ask(args.question); return { answer, sources: sources.map((s) => ({ title: s.title, url: s.url, })), }; },
- src/lib/schemas.ts:146-148 (schema)Zod schema defining the input for ask_wiki: requires a non-empty question string.export const askWikiSchema = z.object({ question: z.string().min(1, 'Question is required'), });
- src/lib/tools.ts:205-209 (registration)Registers the 'ask_wiki' tool definition for MCP, linking name, description, and input schema.createTool( 'ask_wiki', 'Ask a question and get an answer based on wiki content using RAG.', 'ask_wiki' ),
- src/lib/handlers/index.ts:26-27 (registration)Includes the smart handlers (containing ask_wiki) into the main ToolHandlers object....createSmartHandlers(ctx), } as ToolHandlers;