Skip to main content
Glama
Cicatriiz

Consumer Rights Wiki MCP Server

search_wiki

Find articles in the Consumer Rights Wiki to address modern consumer exploitation issues such as privacy violations, dark patterns, and deceptive pricing practices.

Instructions

Search for articles in the Consumer Rights Wiki

Input Schema

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

Implementation Reference

  • The main handler function for the 'search_wiki' tool. It extracts 'query' and optional 'limit' from input arguments, calls the wiki API search endpoint via makeApiRequest, handles errors, formats the results with details like title, size, wordcount, timestamp, cleaned snippet, and constructed URL, and returns as MCP content.
    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), }, ], }; }
  • Input schema defining the parameters for the search_wiki tool: required 'query' string and optional 'limit' number (default 10).
    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:64-81 (registration)
    Tool registration in the ListToolsRequest handler, defining name, description, and input schema for search_wiki.
    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)
    Routing in the CallToolRequest handler switch statement that invokes searchWiki for 'search_wiki' tool calls.
    case 'search_wiki': return this.searchWiki(request.params.arguments);
  • Utility function to perform API requests to the Consumer Rights Wiki, used by searchWiki and other tools to query the MediaWiki API and handle errors appropriately.
    private async makeApiRequest(params: Record<string, string>): Promise<WikiResponse> { try { const response = await axios.get(API_ENDPOINT, { params: { format: 'json', ...params, }, }); return response.data; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to make API request: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }

Other Tools

Related Tools

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/Cicatriiz/consumer-rights-wiki-mcp'

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