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
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Wiki page title | |
| comment | No | Reason for undeleting the page |
Implementation Reference
- src/tools/undelete-page.ts:29-52 (handler)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 ) }; }
- src/tools/undelete-page.ts:10-27 (registration)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 ) ); }
- src/tools/undelete-page.ts:54-61 (helper)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 }` } ]; }
- src/tools/index.ts:36-36 (registration)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 );