ask_wiki
Get answers to questions by retrieving relevant information from wiki content using RAG technology.
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 handler function for the 'ask_wiki' tool. It checks if the brain (AI/vector store) is enabled, then queries it with the user's question using RAG to retrieve an answer and relevant sources.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 the 'ask_wiki' tool: requires a 'question' string.export const askWikiSchema = z.object({ question: z.string().min(1, 'Question is required'), });
- src/lib/handlers/index.ts:19-28 (registration)Registers the smart handlers (including 'ask_wiki') by spreading createSmartHandlers into the full set of tool handlers.export function createAllHandlers(ctx: AppContext): ToolHandlers { return { ...createSearchHandlers(ctx), ...createDocumentHandlers(ctx), ...createCollectionHandlers(ctx), ...createCommentHandlers(ctx), ...createBatchHandlers(ctx), ...createSmartHandlers(ctx), } as ToolHandlers; }
- src/lib/tools.ts:205-209 (registration)Registers the 'ask_wiki' tool definition for MCP, including name, description, and schema reference.createTool( 'ask_wiki', 'Ask a question and get an answer based on wiki content using RAG.', 'ask_wiki' ),
- src/lib/schemas.ts:245-245 (schema)Maps the 'ask_wiki' tool name to its Zod schema in the central toolSchemas object.ask_wiki: askWikiSchema,