get_page_sections
Extract section structure from Consumer Rights Wiki pages to navigate content on privacy violations, dark patterns, and deceptive pricing practices.
Instructions
Get the section structure of a wiki page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | The title of the wiki page |
Implementation Reference
- src/index.ts:451-484 (handler)The handler function that executes the tool logic: fetches page sections via MediaWiki API parse action, processes the sections data, and returns a structured JSON response.private async getPageSections(args: any) { const { title } = args; const data = await this.makeApiRequest({ action: 'parse', page: title, prop: 'sections', }); if (data.error) { throw new McpError(ErrorCode.InternalError, data.error.info); } const sections = data.parse?.sections || []; return { content: [ { type: 'text', text: JSON.stringify({ title: data.parse?.title, sections: sections.map((section: any) => ({ index: section.index, level: parseInt(section.level), line: section.line, number: section.number, anchor: section.anchor, byteoffset: section.byteoffset, })), }, null, 2), }, ], }; }
- src/index.ts:153-162 (schema)Input schema definition for the tool, specifying the required 'title' parameter.inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'The title of the wiki page', }, }, required: ['title'], },
- src/index.ts:179-180 (registration)Tool dispatcher in the CallToolRequestHandler switch statement, routing calls to the getPageSections method.case 'get_page_sections': return this.getPageSections(request.params.arguments);
- src/index.ts:150-163 (registration)Tool metadata registration in the ListToolsRequestHandler response, including name, description, and schema.{ name: 'get_page_sections', description: 'Get the section structure of a wiki page', inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'The title of the wiki page', }, }, required: ['title'], }, },