Skip to main content
Glama
ProfessionalWiki

mediawiki-mcp-server

set-wiki

Destructive

Configure the MediaWiki instance for your current session. Call this tool when switching to a different wiki to ensure proper interaction with the selected platform.

Instructions

Sets the wiki to use for the current session. You MUST call this tool when interacting with a new wiki.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uriYesMCP resource URI of the wiki to use (e.g. mcp://wikis/en.wikipedia.org)

Implementation Reference

  • The handler function for the set-wiki tool. Parses the provided URI to extract wikiKey, checks if the wiki exists, sets it as current using wikiService, clears MWN cache, and returns a success message with wiki details or an error if invalid.
    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;
    	}
    }
  • Registers the set-wiki tool with the MCP server, specifying name, description, input schema (uri as string), tool annotations, and references the handleSetWikiTool 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 )
    	);
    }
  • Zod schema for the set-wiki tool input parameters: uri as a string describing the MCP resource URI of the wiki.
    	uri: z.string().describe( 'MCP resource URI of the wiki to use (e.g. mcp://wikis/en.wikipedia.org)' )
    },
  • Includes the setWikiTool registrar in the array of all tool registrars used by registerAllTools to register all wiki tools with the MCP server.
    const toolRegistrars = [
    	getPageTool,
    	getPageHistoryTool,
    	searchPageTool,
    	setWikiTool,
    	addWikiTool,
    	removeWikiTool,
    	updatePageTool,
    	getFileTool,
    	createPageTool,
    	uploadFileTool,
    	uploadFileFromUrlTool,
    	deletePageTool,
    	getRevisionTool,
    	undeletePageTool,
    	getCategoryMembersTool,
    	searchPageByPrefixTool
    ];
  • src/tools/index.ts:8-8 (registration)
    Imports the setWikiTool function from set-wiki for inclusion in the tools registry.
    import { setWikiTool } from './set-wiki.js';
Behavior4/5

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

The annotations include 'destructiveHint: true', indicating a potentially destructive operation. The description adds valuable context by explaining that this sets the wiki 'for the current session', which clarifies the scope of the destructive effect (it changes session state rather than deleting data). However, it doesn't detail side effects like whether previous session data is lost or if authentication is needed.

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?

The description is two concise sentences that are front-loaded with the core purpose and essential usage rule. Every word earns its place, with no redundancy or fluff, making it highly efficient and easy to parse.

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?

Given the tool's moderate complexity (session state management) and the presence of annotations (destructiveHint) but no output schema, the description is mostly complete. It covers purpose and critical usage guidelines but lacks details on behavioral outcomes (e.g., what happens to the previous session state) or error conditions, leaving minor gaps.

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?

The input schema has 100% description coverage, with the 'uri' parameter fully documented. The description does not add any meaning beyond the schema, such as examples of valid URIs beyond the one given or constraints on wiki selection. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't detract.

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?

The description clearly states the specific action ('Sets the wiki to use') and resource ('for the current session'), distinguishing it from siblings like 'add-wiki' (which likely adds a wiki to a list) or 'remove-wiki' (which removes one). The verb 'Sets' is precise and the scope 'current session' clarifies the temporal context.

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?

The description provides explicit guidance on when to use this tool: 'You MUST call this tool when interacting with a new wiki.' This clearly indicates the prerequisite context (starting work with a new wiki) and implies it should not be used for ongoing sessions with the same wiki, though it doesn't name specific alternatives.

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