get_page_content
Retrieve complete content from Consumer Rights Wiki pages to access detailed information about privacy violations, dark patterns, and deceptive pricing practices.
Instructions
Get the full content of a specific wiki page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | The title of the wiki page | |
| section | No | Optional section number to retrieve |
Implementation Reference
- src/index.ts:228-286 (handler)The core handler function that executes the get_page_content tool logic: fetches wiki page content via API, strips HTML, processes entities, and returns structured JSON response.private async getPageContent(args: any) { const { title, section } = args; const params: Record<string, string> = { action: 'parse', page: title, prop: 'text|sections|categories|links|externallinks', disablelimitreport: '1', disableeditsection: '1', }; if (section !== undefined) { params.section = section.toString(); } const data = await this.makeApiRequest(params); if (data.error) { throw new McpError(ErrorCode.InternalError, data.error.info); } const parse = data.parse; if (!parse) { throw new McpError(ErrorCode.InvalidRequest, `Page '${title}' not found`); } // Extract text content and remove HTML const htmlContent = parse.text['*']; const textContent = htmlContent .replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '') .replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi, '') .replace(/<[^>]*>/g, '') .replace(/ /g, ' ') .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, "'") .replace(/\n\s*\n/g, '\n\n') .trim(); return { content: [ { type: 'text', text: JSON.stringify({ title: parse.title, pageid: parse.pageid, content: textContent, categories: parse.categories?.map((cat: any) => cat['*']) || [], sections: parse.sections || [], internalLinks: parse.links?.map((link: any) => link['*']) || [], externalLinks: parse.externallinks || [], url: `${WIKI_BASE_URL}/${title.replace(/ /g, '_')}`, }, null, 2), }, ], }; }
- src/index.ts:82-99 (registration)Tool registration in the listTools handler, including name, description, and input schema definition.{ name: 'get_page_content', description: 'Get the full content of a specific wiki page', inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'The title of the wiki page', }, section: { type: 'number', description: 'Optional section number to retrieve', }, }, required: ['title'], }, },
- src/index.ts:171-172 (handler)Dispatch case in the central CallToolRequestSchema handler that routes calls to the getPageContent method.case 'get_page_content': return this.getPageContent(request.params.arguments);
- src/index.ts:43-58 (helper)Utility helper function used by getPageContent to perform API requests to the wiki endpoint.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'}` ); } }