remove-wiki
Remove a wiki from the MCP server resources by specifying its URI to manage MediaWiki connections.
Instructions
Removes a wiki from the MCP resources.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uri | Yes | MCP resource URI of the wiki to remove (e.g. mcp://wikis/en.wikipedia.org) |
Implementation Reference
- src/tools/remove-wiki.ts:25-72 (handler)Handler function that implements the core logic of the remove-wiki tool: parses URI, validates wiki existence and current status, removes from wikiService, updates resources, clears cache, handles errors.async function handleRemoveWikiTool( server: McpServer, uri: string ): Promise<CallToolResult> { try { const { wikiKey } = parseWikiResourceUri( uri ); const wikiToRemove = wikiService.get( wikiKey ); if ( !wikiToRemove ) { return { content: [ { type: 'text', text: `mcp://wikis/${ wikiKey } not found in MCP resources.` } as TextContent ], isError: true }; } if ( wikiService.getCurrent().key === wikiKey ) { return { content: [ { type: 'text', text: 'Cannot remove the currently active wiki. Please set a different wiki as the active wiki before removing this one.' } as TextContent ], isError: true }; } wikiService.remove( wikiKey ); server.sendResourceListChanged(); clearMwnCache(); return { content: [ { type: 'text', text: `${ wikiToRemove.sitename } (mcp://wikis/${ wikiKey }) has been removed from MCP resources.` } as TextContent ] }; } catch ( error ) { if ( error instanceof InvalidWikiResourceUriError ) { return { content: [ { type: 'text', text: error.message } as TextContent ], isError: true }; } throw error; } }
- src/tools/remove-wiki.ts:10-23 (registration)Registers the remove-wiki tool with the MCP server, including name, description, input schema (uri: zod string), annotations, and links to the handler function.export function removeWikiTool( server: McpServer ): RegisteredTool { return server.tool( 'remove-wiki', 'Removes a wiki from the MCP resources.', { uri: z.string().describe( 'MCP resource URI of the wiki to remove (e.g. mcp://wikis/en.wikipedia.org)' ) }, { title: 'Remove wiki', destructiveHint: true } as ToolAnnotations, ( { uri } ) => handleRemoveWikiTool( server, uri ) ); }
- src/tools/remove-wiki.ts:15-15 (schema)Zod input schema for the tool's 'uri' parameter.uri: z.string().describe( 'MCP resource URI of the wiki to remove (e.g. mcp://wikis/en.wikipedia.org)' )
- src/tools/index.ts:28-28 (registration)The removeWikiTool registrar is included in the array of all tool registrars called by registerAllTools.removeWikiTool,
- src/tools/index.ts:41-51 (registration)Global function that registers all tools, including remove-wiki, by invoking each registrar with the server instance.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; }