Skip to main content
Glama
ProfessionalWiki

mediawiki-mcp-server

undelete-page

Restore deleted wiki pages by providing the page title and optional restoration reason. This tool enables users to recover previously removed content on MediaWiki platforms.

Instructions

Undeletes a wiki page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesWiki page title
commentNoReason for undeleting the page

Implementation Reference

  • The handler function that executes the tool's core logic: undeletes the page using mwn.undelete, handles exceptions, and returns success or error content.
    async function handleUndeletePageTool(
    	title: string,
    	comment?: string
    ): Promise<CallToolResult> {
    	let data: ApiUndeleteResponse;
    	try {
    		const mwn = await getMwn();
    		data = await mwn.undelete( title, formatEditComment( 'undelete-page', comment ) );
    	} catch ( error ) {
    		return {
    			content: [
    				{
    					type: 'text',
    					text: `Undelete failed: ${ ( error as Error ).message }`
    				} as TextContent
    			],
    			isError: true
    		};
    	}
    
    	return {
    		content: undeletePageToolResult( data )
    	};
    }
  • Registers the 'undelete-page' tool on the MCP server, including name, description, input schema (title, optional comment), annotations, and links to the handler.
    export function undeletePageTool( server: McpServer ): RegisteredTool {
    	return server.tool(
    		'undelete-page',
    		'Undeletes a wiki page.',
    		{
    			title: z.string().describe( 'Wiki page title' ),
    			comment: z.string().optional().describe( 'Reason for undeleting the page' )
    		},
    		{
    			title: 'Undelete page',
    			readOnlyHint: false,
    			destructiveHint: true
    		} as ToolAnnotations,
    		async (
    			{ title, comment }
    		) => handleUndeletePageTool( title, comment )
    	);
    }
  • Helper function that formats the API response into the tool's output TextContent array.
    function undeletePageToolResult( data: ApiUndeleteResponse ): TextContent[] {
    	return [
    		{
    			type: 'text',
    			text: `Page undeleted successfully: ${ data.title }`
    		}
    	];
    }
  • The undeletePageTool registrar is included in the toolRegistrars array, which is used by registerAllTools to register all tools.
    undeletePageTool,
  • src/server.ts:29-29 (registration)
    Top-level call to registerAllTools(server), which triggers registration of undelete-page among other tools.
    registerAllTools( server );

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