Skip to main content
Glama

get-page-history

Retrieve revision history segments for wiki pages to track changes and navigate through edit timelines in MediaWiki.

Instructions

Returns information about the latest revisions to a wiki page, in segments of 20 revisions, starting with the latest revision. The response includes API routes for the next oldest, next newest, and latest revision segments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesWiki page title
olderThanNoRevision ID of the oldest revision to return
newerThanNoRevision ID of the newest revision to return
filterNoFilter that returns only revisions with certain tags. Only support one filter per request.

Implementation Reference

  • Core handler function that constructs API parameters, fetches page history via REST API, handles errors and empty results, and maps revisions to formatted text content using the helper.
    async function handleGetPageHistoryTool( title: string, olderThan?: number, newerThan?: number, filter?: string ): Promise< CallToolResult > { const params: Record<string, string> = {}; if ( olderThan ) { params.olderThan = olderThan.toString(); } if ( newerThan ) { params.newerThan = newerThan.toString(); } if ( filter ) { params.filter = filter; } let data: MwRestApiGetPageHistoryResponse; try { data = await makeRestGetRequest<MwRestApiGetPageHistoryResponse>( `/v1/page/${ encodeURIComponent( title ) }/history`, params ); } catch ( error ) { return { content: [ { type: 'text', text: `Failed to retrieve page history: ${ ( error as Error ).message }` } as TextContent ], isError: true }; } if ( data.revisions.length === 0 ) { return { content: [ { type: 'text', text: 'No revisions found for page' } as TextContent ] }; } return { content: data.revisions.map( getPageHistoryToolResult ) }; }
  • Tool registrar function that calls server.tool to register 'get-page-history' with description, Zod input schema, annotations, and handler.
    export function getPageHistoryTool( server: McpServer ): RegisteredTool { return server.tool( 'get-page-history', 'Returns information about the latest revisions to a wiki page, in segments of 20 revisions, starting with the latest revision. The response includes API routes for the next oldest, next newest, and latest revision segments.', { title: z.string().describe( 'Wiki page title' ), olderThan: z.number().int().positive().optional().describe( 'Revision ID of the oldest revision to return' ), newerThan: z.number().int().positive().optional().describe( 'Revision ID of the newest revision to return' ), filter: z.string().optional().describe( 'Filter that returns only revisions with certain tags. Only support one filter per request.' ) }, { title: 'Get page history', readOnlyHint: true, destructiveHint: false } as ToolAnnotations, async ( { title, olderThan, newerThan, filter } ) => handleGetPageHistoryTool( title, olderThan, newerThan, filter ) ); }
  • Helper function to format individual revision data into a multi-line text block.
    function getPageHistoryToolResult( result: MwRestApiRevisionObject ): TextContent { return { type: 'text', text: [ `Revision ID: ${ result.id }`, `Timestamp: ${ result.timestamp }`, `User: ${ result.user.name } (ID: ${ result.user.id })`, `Comment: ${ result.comment }`, `Size: ${ result.size }`, `Delta: ${ result.delta }` ].join( '\n' ) }; }
  • Imports the getPageHistoryTool registrar and adds it to the list of all tool registrars called by registerAllTools.
    import { getPageHistoryTool } from './get-page-history.js'; import { searchPageTool } from './search-page.js'; import { setWikiTool } from './set-wiki.js'; import { addWikiTool } from './add-wiki.js'; import { removeWikiTool } from './remove-wiki.js'; import { updatePageTool } from './update-page.js'; import { getFileTool } from './get-file.js'; import { createPageTool } from './create-page.js'; import { uploadFileTool } from './upload-file.js'; import { uploadFileFromUrlTool } from './upload-file-from-url.js'; import { deletePageTool } from './delete-page.js'; import { getRevisionTool } from './get-revision.js'; import { undeletePageTool } from './undelete-page.js'; import { getCategoryMembersTool } from './get-category-members.js'; import { searchPageByPrefixTool } from './search-page-by-prefix.js'; const toolRegistrars = [ getPageTool, getPageHistoryTool,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ProfessionalWiki/MediaWiki-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server