Skip to main content
Glama

undelete-page

Idempotent

Restores a deleted wiki page with full revision history. Requires deleted state and undelete permission.

Instructions

Restores a previously deleted wiki page, including its full revision history, and returns the restored title. The page must currently be in a deleted state (from delete-page); fails if no deleted revisions exist for the title or the authenticated user lacks the undelete permission.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesWiki page title
commentNoReason for undeleting the page

Implementation Reference

  • The handle function that executes the undelete-page tool logic. Calls mwn.undelete() with the title, formatted comment, and edit options. Returns the restored title and revision count.
    	async handle({ title, comment }, ctx: ToolContext): Promise<CallToolResult> {
    		const mwn = await ctx.mwn();
    		const options = ctx.edit.applyTags<ApiUndeleteParams>({});
    		const data: ApiUndeleteResponse & { revisions?: number } = await mwn.undelete(
    			title,
    			formatEditComment('undelete-page', comment),
    			options,
    		);
    
    		return ctx.format.ok({
    			// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- mwn API response shape; trusted at this boundary
    			title: data.title as string,
    			restored: true as const,
    			revisionCount: data.revisions,
    		});
    	},
    };
  • Zod input schema for the undelete-page tool: requires 'title' (string) and optional 'comment' (string) for the undeletion reason.
    const inputSchema = {
    	title: z.string().describe('Wiki page title'),
    	comment: z.string().optional().describe('Reason for undeleting the page'),
    } as const;
  • Registration of undeletePage in the standardTools array, which gets registered with the MCP server via the registerAllTools function.
    	undeletePage,
    	uploadFile,
    	uploadFileFromUrl,
    	updateFile,
    	updateFileFromUrl,
    	oauthStatus,
    	oauthLogout,
    ];
  • Helper function formatEditComment used to format the edit summary for the undelete action, appending '(via undelete-page on MediaWiki MCP Server)'.
    export function formatEditComment(tool: string, comment?: string): string {
    	const suffix = `(via ${tool} on MediaWiki MCP Server)`;
    	if (!comment) {
    		return `Automated edit ${suffix}`;
    	}
    	return `${comment} ${suffix}`;
    }
  • Tool gating: 'undelete-page' is listed in WRITE_TOOL_NAMES to conditionally hide it when the wiki is in read-only mode.
    const WRITE_TOOL_NAMES: readonly string[] = [
    	'create-page',
    	'update-page',
    	'delete-page',
    	'undelete-page',
    	'upload-file',
    	'upload-file-from-url',
    	'update-file',
    	'update-file-from-url',
    ];
Behavior5/5

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

Discloses key behaviors beyond annotations: restores full revision history, returns the title, and fails under specific conditions. Does not contradict any annotations.

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?

Two concise sentences that cover purpose, prerequisites, and outcomes without unnecessary detail. Front-loaded with the core action.

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?

Describes the return value and conditions for failure. Lacks detail on the exact structure of the response (e.g., just the title string), but this is acceptable given the simple operation.

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 coverage is 100% so description adds little beyond schema. It confirms 'title' must be a deleted page and 'comment' is a reason, but this is minimal additional value.

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?

Clearly states the verb 'restores', the resource 'deleted wiki page', and the outcome 'full revision history and returns the title'. Distinguishes from sibling 'delete-page' by specifying it is the inverse operation.

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?

Explicitly states when to use: 'page must currently be in a deleted state (from delete-page)'. Also specifies failure conditions: no deleted revisions or lack of permission. Provides clear guidance on prerequisites.

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