Skip to main content
Glama

set-wiki

Define the target wiki for the current session by specifying its URL, enabling direct interaction with the chosen MediaWiki instance.

Instructions

Set the wiki to use for the current session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wikiUrlYesAny URL from the target wiki (e.g. https://en.wikipedia.org/wiki/Main_Page).

Implementation Reference

  • Implements the core logic of the 'set-wiki' tool: parses the provided URI to extract wikiKey, checks if the wiki exists in resources, sets it as the current wiki, clears the MW cache, and returns a success message with wiki details or an appropriate error.
    async function handleSetWikiTool( uri: string ): Promise<CallToolResult> { try { const { wikiKey } = parseWikiResourceUri( uri ); if ( !wikiService.get( wikiKey ) ) { return { content: [ { type: 'text', text: `mcp://wikis/${ wikiKey } not found in MCP resources.` } as TextContent ], isError: true }; } wikiService.setCurrent( wikiKey ); clearMwnCache(); const newConfig = wikiService.getCurrent().config; return { content: [ { type: 'text', text: `Wiki set to ${ newConfig.sitename } (${ newConfig.server })` } as TextContent ] }; } catch ( error ) { if ( error instanceof InvalidWikiResourceUriError ) { return { content: [ { type: 'text', text: error.message } as TextContent ], isError: true }; } throw error; } }
  • Specific registrar function for the 'set-wiki' tool, called by the general registerAllTools. Defines tool name, description, input schema (uri: string), annotations, and links to the handler.
    export function setWikiTool( server: McpServer ): RegisteredTool { return server.tool( 'set-wiki', 'Sets the wiki to use for the current session. You MUST call this tool when interacting with a new wiki.', { uri: z.string().describe( 'MCP resource URI of the wiki to use (e.g. mcp://wikis/en.wikipedia.org)' ) }, { title: 'Set wiki', destructiveHint: true } as ToolAnnotations, ( { uri } ) => handleSetWikiTool( uri ) ); }
  • The setWikiTool registrar (line 26) is listed here among all tool registrars. This array is iterated in registerAllTools(server) to register every tool including 'set-wiki'.
    const toolRegistrars = [ getPageTool, getPageHistoryTool, searchPageTool, setWikiTool, addWikiTool, removeWikiTool, updatePageTool, getFileTool, createPageTool, uploadFileTool, uploadFileFromUrlTool, deletePageTool, getRevisionTool, undeletePageTool, getCategoryMembersTool, searchPageByPrefixTool ];
  • src/server.ts:29-29 (registration)
    Top-level call to registerAllTools on the MCP server instance, which triggers registration of 'set-wiki' via the chain.
    registerAllTools( server );

Other Tools

Related 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