Skip to main content
Glama
ProfessionalWiki

mediawiki-mcp-server

get-revision

Read-only

Retrieve specific revisions of wiki pages to access historical content, view changes, or analyze edit history with optional metadata and content formats.

Instructions

Returns a revision of a wiki page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
revisionIdYesRevision ID
contentNoType of content to returnsource
metadataNoWhether to include metadata (revision ID, page ID, page title, user ID, user name, timestamp, comment, size, delta, minor, HTML URL) in the response

Implementation Reference

  • Primary handler function that validates parameters, fetches revision data from the REST API, and returns formatted content or error response.
    async function handleGetRevisionTool(
    	revisionId: number, content: ContentFormat, metadata: boolean
    ): Promise<CallToolResult> {
    	if ( content === ContentFormat.none && !metadata ) {
    		return {
    			content: [ {
    				type: 'text',
    				text: 'When content is set to "none", metadata must be true'
    			} ],
    			isError: true
    		};
    	}
    
    	try {
    		const data = await makeRestGetRequest<MwRestApiRevisionObject>(
    			`/v1/revision/${ revisionId }${ getSubEndpoint( content ) }`
    		);
    		return {
    			content: getRevisionToolResult( data, content, metadata )
    		};
    	} catch ( error ) {
    		return {
    			content: [
    				{ type: 'text', text: `Failed to retrieve revision data: ${ ( error as Error ).message }` } as TextContent
    			],
    			isError: true
    		};
    	}
    }
  • Input schema definition for the tool using Zod, including revisionId, optional content format, and optional metadata flag.
    	revisionId: z.number().int().positive().describe( 'Revision ID' ),
    	content: z.nativeEnum( ContentFormat ).describe( 'Type of content to return' ).optional().default( ContentFormat.source ),
    	metadata: z.boolean().describe( 'Whether to include metadata (revision ID, page ID, page title, user ID, user name, timestamp, comment, size, delta, minor, HTML URL) in the response' ).optional().default( false )
    },
  • Registers the 'get-revision' tool on the MCP server with name, description, schema, annotations, and handler lambda.
    export function getRevisionTool( server: McpServer ): RegisteredTool {
    	return server.tool(
    		'get-revision',
    		'Returns a revision of a wiki page.',
    		{
    			revisionId: z.number().int().positive().describe( 'Revision ID' ),
    			content: z.nativeEnum( ContentFormat ).describe( 'Type of content to return' ).optional().default( ContentFormat.source ),
    			metadata: z.boolean().describe( 'Whether to include metadata (revision ID, page ID, page title, user ID, user name, timestamp, comment, size, delta, minor, HTML URL) in the response' ).optional().default( false )
    		},
    		{
    			title: 'Get revision',
    			readOnlyHint: true,
    			destructiveHint: false
    		} as ToolAnnotations,
    		async (
    			{ revisionId, content, metadata }
    		) => handleGetRevisionTool( revisionId, content, metadata )
    	);
    }
  • Helper function that formats the API response into an array of TextContent based on content type and metadata requirements.
    function getRevisionToolResult(
    	result: MwRestApiRevisionObject,
    	content: ContentFormat,
    	metadata: boolean
    ): TextContent[] {
    	if ( content === ContentFormat.source && !metadata ) {
    		return [ {
    			type: 'text',
    			text: result.source ?? 'Not available'
    		} ];
    	}
    
    	if ( content === ContentFormat.html && !metadata ) {
    		return [ {
    			type: 'text',
    			text: result.html ?? 'Not available'
    		} ];
    	}
    
    	const results: TextContent[] = [ getRevisionMetadataTextContent( result ) ];
    
    	if ( result.source !== undefined ) {
    		results.push( {
    			type: 'text',
    			text: `Source:\n${ result.source }`
    		} );
    	}
    
    	if ( result.html !== undefined ) {
    		results.push( {
    			type: 'text',
    			text: `HTML:\n${ result.html }`
    		} );
    	}
    
    	return results;
    }
  • Top-level registration function that invokes all tool registrars, including getRevisionTool, on the MCP server.
    export function registerAllTools( server: McpServer ): RegisteredTool[] {
    	const registeredTools: RegisteredTool[] = [];
    	for ( const registrar of toolRegistrars ) {
    		try {
    			registeredTools.push( registrar( server ) );
    		} catch ( error ) {
    			console.error( `Error registering tool: ${ ( error as Error ).message }` );
    		}
    	}
    	return registeredTools;
    }
Behavior3/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the agent knows this is a safe read operation. The description adds minimal behavioral context beyond this - it specifies what's returned (a revision) but doesn't mention response format, error conditions, or other operational details. With annotations covering safety, this earns a baseline score.

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

Conciseness5/5

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

The description is a single, efficient sentence that states the core functionality without unnecessary words. It's appropriately sized for a simple retrieval tool and gets straight to the point with zero wasted verbiage.

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?

For a read operation with good annotations (readOnlyHint, destructiveHint) and comprehensive schema coverage, the description provides adequate but minimal context. However, without an output schema, the description doesn't explain what format the revision data returns in or what the response structure looks like, leaving a gap in completeness.

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%, with all parameters well-documented in the schema itself. The description adds no additional parameter information beyond what's already in the structured schema, so it meets but doesn't exceed the baseline expectation when schema coverage is complete.

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 action ('Returns') and resource ('a revision of a wiki page'), making the purpose immediately understandable. However, it doesn't distinguish this tool from similar sibling tools like 'get-page' or 'get-page-history', which also retrieve wiki content, so it doesn't achieve full sibling differentiation.

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. With sibling tools like 'get-page' (for current page content) and 'get-page-history' (for revision lists), the agent must infer usage context without explicit direction about when this specific revision retrieval tool is appropriate.

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