get_page_sections
Extract the section structure of a Consumer Rights Wiki page by providing its title, helping users navigate and analyze content on consumer exploitation topics like privacy violations and deceptive pricing.
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 main handler function for the 'get_page_sections' tool. It takes a page title, queries the MediaWiki API for parse sections, processes the sections data, and returns a structured JSON response with section details including index, level, line, number, anchor, and byteoffset.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:150-163 (registration)Tool registration in the ListTools handler, defining the tool name, description, and input schema requiring a 'title' string.{ 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'], }, },
- src/index.ts:179-180 (registration)Dispatch registration in the CallToolRequest handler switch statement, routing calls to the getPageSections method.case 'get_page_sections': return this.getPageSections(request.params.arguments);