search_wiki
Search the Consumer Rights Wiki to find articles about privacy violations, dark patterns, and deceptive pricing practices. Get information on modern consumer exploitation issues.
Instructions
Search for articles in the Consumer Rights Wiki
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query | |
| limit | No | Number of results to return (default: 10, max: 50) |
Implementation Reference
- src/index.ts:190-226 (handler)The main handler function that implements the logic for the 'search_wiki' tool. It destructures the input arguments, makes an API request to the wiki search endpoint, processes the response, and returns formatted search results including titles, snippets, sizes, and URLs.private async searchWiki(args: any) { const { query, limit = 10 } = args; const data = await this.makeApiRequest({ action: 'query', list: 'search', srsearch: query, srlimit: Math.min(limit, 50).toString(), srprop: 'size|wordcount|timestamp|snippet', }); if (data.error) { throw new McpError(ErrorCode.InternalError, data.error.info); } const results = data.query?.search || []; return { content: [ { type: 'text', text: JSON.stringify({ query: query, totalResults: data.query?.searchinfo?.totalhits || 0, results: results.map((result: any) => ({ title: result.title, size: result.size, wordcount: result.wordcount, timestamp: result.timestamp, snippet: result.snippet.replace(/<[^>]*>/g, ''), // Remove HTML tags url: `${WIKI_BASE_URL}/${result.title.replace(/ /g, '_')}`, })), }, null, 2), }, ], }; }
- src/index.ts:66-80 (schema)The input schema for the 'search_wiki' tool, defining the expected parameters: a required 'query' string and an optional 'limit' number (default 10, max 50).inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query', }, limit: { type: 'number', description: 'Number of results to return (default: 10, max: 50)', default: 10, }, }, required: ['query'], },
- src/index.ts:63-81 (registration)The tool descriptor registration for 'search_wiki' in the ListTools response, including name, description, and input schema.{ name: 'search_wiki', description: 'Search for articles in the Consumer Rights Wiki', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query', }, limit: { type: 'number', description: 'Number of results to return (default: 10, max: 50)', default: 10, }, }, required: ['query'], }, },
- src/index.ts:169-170 (registration)The switch case in the CallToolRequest handler that routes calls to the 'search_wiki' handler function.case 'search_wiki': return this.searchWiki(request.params.arguments);