Skip to main content
Glama

search_pages

Find wiki pages by entering keywords to locate relevant information quickly.

Instructions

Search for pages in the wiki using keywords

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query string
limitNoMaximum number of results to return (default: 10, max: 50)

Implementation Reference

  • MCP tool call handler for 'search_pages': extracts parameters, calls wikiClient.searchPages, formats results into JSON response with total hits and page details.
    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 ) } ] }; }
  • MediaWikiClient.searchPages method: performs the actual MediaWiki API search query using makeApiCall.
    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" }); }
  • Tool object definition with name 'search_pages', description, and inputSchema specifying query (required) and optional limit.
    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:597-607 (registration)
    Registers SEARCH_PAGES_TOOL in the MCP server's listTools response, making it discoverable.
    // Register the tools server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ SEARCH_PAGES_TOOL, READ_PAGE_TOOL, CREATE_PAGE_TOOL, UPDATE_PAGE_TOOL, GET_PAGE_HISTORY_TOOL, GET_CATEGORIES_TOOL ] }));

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cryppadotta/mcp-wizzypedia'

If you have feedback or need assistance with the MCP directory API, please join our Discord server