search_pages
Find relevant wiki pages on Wizzypedia by entering keywords, with customizable result limits for efficient searching within the MCP-enabled environment.
Instructions
Search for pages in the wiki using keywords
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of results to return (default: 10, max: 50) | |
| query | Yes | Search query string |
Input Schema (JSON Schema)
{
"properties": {
"limit": {
"default": 10,
"description": "Maximum number of results to return (default: 10, max: 50)",
"type": "number"
},
"query": {
"description": "Search query string",
"type": "string"
}
},
"required": [
"query"
],
"type": "object"
}
Implementation Reference
- index.ts:628-659 (handler)MCP CallToolRequest handler case for 'search_pages': parses arguments, calls wikiClient.searchPages with limit capped at 50, formats search results into JSON with titles, snippets, sizes, wordcounts, timestamps, and total hits.case "search_pages": { const { query, limit = 10 } = request.params.arguments as { query: string; limit?: number; }; const result = await wikiClient.searchPages(query, Math.min(limit, 50)); // Format search results in a readable way const pages = result.query.search.map((page: any) => ({ title: page.title, snippet: page.snippet, size: page.size, wordCount: page.wordcount, timestamp: page.timestamp })); return { content: [ { type: "text", text: JSON.stringify( { totalHits: result.query.searchinfo.totalhits, pages }, null, 2 ) } ] }; }
- index.ts:465-484 (schema)Tool definition including name, description, and input schema for 'search_pages': requires 'query' string, optional 'limit' number (default 10).const SEARCH_PAGES_TOOL: Tool = { name: "search_pages", description: "Search for pages in the wiki using keywords", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query string" }, limit: { type: "number", description: "Maximum number of results to return (default: 10, max: 50)", default: 10 } }, required: ["query"] } };
- index.ts:379-388 (helper)MediaWikiClient.searchPages helper: performs API query/list=search with srsearch=query, srlimit=limit, including totalhits, size, wordcount, timestamp, snippet.async searchPages(query: string, limit: number = 10): Promise<any> { return this.makeApiCall({ action: "query", list: "search", srsearch: query, srlimit: limit, srinfo: "totalhits", srprop: "size|wordcount|timestamp|snippet" }); }
- index.ts:598-607 (registration)Registers SEARCH_PAGES_TOOL in the ListToolsRequestSchema handler, making it discoverable by MCP clients.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ SEARCH_PAGES_TOOL, READ_PAGE_TOOL, CREATE_PAGE_TOOL, UPDATE_PAGE_TOOL, GET_PAGE_HISTORY_TOOL, GET_CATEGORIES_TOOL ] }));