get_recent_changes
Retrieve recent edits to the Consumer Rights Wiki, allowing users to monitor updates on main articles or specific namespaces with customizable limits.
Instructions
Get recent changes to the wiki
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of recent changes to return (default: 10, max: 50) | |
| namespace | No | Filter by namespace (0 = main articles) |
Implementation Reference
- src/index.ts:337-382 (handler)The main handler function implementing the logic to fetch recent changes from the Consumer Rights Wiki using the MediaWiki API.private async getRecentChanges(args: any) { const { limit = 10, namespace } = args; const params: Record<string, string> = { action: 'query', list: 'recentchanges', rcprop: 'title|timestamp|user|comment|sizes|flags', rclimit: Math.min(limit, 50).toString(), }; if (namespace !== undefined) { params.rcnamespace = namespace.toString(); } const data = await this.makeApiRequest(params); if (data.error) { throw new McpError(ErrorCode.InternalError, data.error.info); } const changes = data.query?.recentchanges || []; return { content: [ { type: 'text', text: JSON.stringify({ recentChanges: changes.map((change: any) => ({ title: change.title, timestamp: change.timestamp, user: change.user, comment: change.comment, oldSize: change.oldlen, newSize: change.newlen, sizeChange: change.newlen - change.oldlen, type: change.type, isNew: change.new === '', isMinor: change.minor === '', isBot: change.bot === '', url: `${WIKI_BASE_URL}/${change.title.replace(/ /g, '_')}`, })), }, null, 2), }, ], }; }
- src/index.ts:114-131 (schema)The input schema and metadata for the get_recent_changes tool, registered in the ListTools response.{ name: 'get_recent_changes', description: 'Get recent changes to the wiki', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Number of recent changes to return (default: 10, max: 50)', default: 10, }, namespace: { type: 'number', description: 'Filter by namespace (0 = main articles)', }, }, }, },
- src/index.ts:175-176 (registration)The switch case in the CallToolRequestHandler that dispatches to the getRecentChanges method.case 'get_recent_changes': return this.getRecentChanges(request.params.arguments);