Skip to main content
Glama
ProfessionalWiki

mediawiki-mcp-server

get-page

Read-only

Retrieve MediaWiki page content, metadata, or revision IDs for editing workflows using the mediawiki-mcp-server.

Instructions

Returns a wiki page. Use metadata=true to retrieve the revision ID required by update-page. Set content="none" to fetch only metadata without content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesWiki page title
contentNoType of content to returnsource
metadataNoWhether to include metadata (page ID, revision info, license) in the response

Implementation Reference

  • Core handler function that performs the REST API call to fetch the wiki page, processes based on content and metadata parameters, and returns success or error response.
    async function handleGetPageTool(
    	title: string, 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<MwRestApiPageObject>(
    			`/v1/page/${ encodeURIComponent( title ) }${ getSubEndpoint( content ) }`
    		);
    		return {
    			content: getPageToolResult( data, content, metadata )
    		};
    	} catch ( error ) {
    		return {
    			content: [
    				{ type: 'text', text: `Failed to retrieve page data: ${ ( error as Error ).message }` } as TextContent
    			],
    			isError: true
    		};
    	}
    }
  • Registers the 'get-page' tool with the MCP server, specifying name, description, Zod input schema, annotations, and async handler.
    export function getPageTool( server: McpServer ): RegisteredTool {
    	return server.tool(
    		'get-page',
    		'Returns a wiki page. Use metadata=true to retrieve the revision ID required by update-page. Set content="none" to fetch only metadata without content.',
    		{
    			title: z.string().describe( 'Wiki page title' ),
    			content: z.nativeEnum( ContentFormat ).optional().default( ContentFormat.source ).describe( 'Type of content to return' ),
    			metadata: z.boolean().optional().default( false ).describe( 'Whether to include metadata (page ID, revision info, license) in the response' )
    		},
    		{
    			title: 'Get page',
    			readOnlyHint: true,
    			destructiveHint: false
    		} as ToolAnnotations,
    		async ( { title, content, metadata } ) => handleGetPageTool( title, content, metadata )
    	);
    }
  • Helper function to construct the TextContent array for the tool response, handling different content formats and metadata.
    function getPageToolResult(
    	result: MwRestApiPageObject, 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[] = [ getPageMetadataTextContent( 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;
    }
  • Helper function to format page metadata into a single TextContent block.
    function getPageMetadataTextContent( result: MwRestApiPageObject ): TextContent {
    	return {
    		type: 'text',
    		text: [
    			`Page ID: ${ result.id }`,
    			`Title: ${ result.title }`,
    			`Latest revision ID: ${ result.latest.id }`,
    			`Latest revision timestamp: ${ result.latest.timestamp }`,
    			`Content model: ${ result.content_model }`,
    			`License: ${ result.license.url } ${ result.license.title }`,
    			`HTML URL: ${ result.html_url ?? 'Not available' }`
    		].join( '\n' )
    	};
    }
  • Array collecting all tool registrar functions, including getPageTool, used by registerAllTools for server-wide tool registration.
    const toolRegistrars = [
    	getPageTool,
    	getPageHistoryTool,
    	searchPageTool,
    	setWikiTool,
    	addWikiTool,
    	removeWikiTool,
    	updatePageTool,
    	getFileTool,
    	createPageTool,
    	uploadFileTool,
    	uploadFileFromUrlTool,
    	deletePageTool,
    	getRevisionTool,
    	undeletePageTool,
    	getCategoryMembersTool,
    	searchPageByPrefixTool
    ];
Behavior4/5

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

While annotations already declare readOnlyHint=true and destructiveHint=false, the description adds valuable behavioral context about the relationship with 'update-page' (needs revision ID) and the content parameter options. It doesn't contradict annotations and provides practical implementation details beyond the safety profile.

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 perfectly concise with two sentences that each serve distinct purposes: the first states the core function, the second provides specific usage guidance. There is zero wasted language, and it's front-loaded with the essential information.

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

Completeness4/5

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

For a read-only tool with good annotations and full schema coverage, the description provides excellent practical guidance about parameter usage and relationships with other tools. The main gap is the lack of output schema, but the description compensates well by explaining what different parameter combinations return.

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

Parameters4/5

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

With 100% schema description coverage, the baseline would be 3, but the description adds meaningful context: it explains the purpose of metadata=true (revision ID for update-page) and content="none" (metadata-only fetch), which goes beyond the schema's technical descriptions. This provides practical guidance for parameter usage.

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

Purpose5/5

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

The description clearly states the specific action ('Returns a wiki page') and resource ('wiki page'), distinguishing it from siblings like 'get-page-history' or 'get-revision' by focusing on current page content. It provides a precise verb+resource combination that is immediately understandable.

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

Usage Guidelines5/5

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

The description explicitly provides usage guidance: 'Use metadata=true to retrieve the revision ID required by update-page' specifies a specific use case, and 'Set content="none" to fetch only metadata without content' offers an alternative usage pattern. It clearly indicates when to use certain parameter combinations for specific purposes.

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