Skip to main content
Glama
ProfessionalWiki

mediawiki-mcp-server

get-page-history

Read-only

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,
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and destructiveHint=false, indicating a safe read operation. The description adds useful behavioral context: it specifies pagination (segments of 20 revisions) and includes API routes for navigation (next oldest, next newest, latest), which aren't covered by annotations. However, it doesn't detail error handling or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, stating the core purpose in the first sentence and adding pagination details in the second. Both sentences earn their place by providing essential information without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (pagination, multiple parameters) and lack of an output schema, the description is moderately complete. It covers the paginated nature and navigation routes but doesn't explain the response structure or error cases, leaving gaps for the agent to handle.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 4 parameters. The description doesn't add any parameter-specific details beyond what's in the schema, such as explaining how 'olderThan' and 'newerThan' interact with pagination. Baseline 3 is appropriate when the schema handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns information about the latest revisions to a wiki page in segments of 20, starting with the latest. It specifies the resource (wiki page revisions) and the action (returns information), but doesn't explicitly differentiate from siblings like 'get-revision' which might fetch a single revision rather than a paginated history.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention siblings like 'get-revision' for single revisions or 'get-page' for current content, leaving the agent to infer usage from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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