get_page_content
Retrieve the full content or specific sections of a wiki page from the Consumer Rights Wiki to access detailed information on consumer exploitation issues like privacy violations and deceptive practices.
Instructions
Get the full content of a specific wiki page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| section | No | Optional section number to retrieve | |
| title | Yes | The title of the wiki page |
Implementation Reference
- src/index.ts:228-287 (handler)The core implementation of the get_page_content tool handler. It fetches the wiki page content via the MediaWiki parse API, cleans the HTML to plain text, and returns a structured JSON with title, content, categories, sections, links, and URL.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 (schema)The input schema definition for the get_page_content tool, specifying required 'title' parameter and optional 'section'.{ 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 (registration)The registration of the get_page_content tool in the CallToolRequest handler switch statement, dispatching to the getPageContent method.case 'get_page_content': return this.getPageContent(request.params.arguments);