Skip to main content
Glama
ProfessionalWiki

mediawiki-mcp-server

create-page

Destructive

Create new wiki pages by providing content and titles for MediaWiki sites through the MCP server.

Instructions

Creates a wiki page with the provided content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesPage content in the format specified by the contentModel parameter
titleYesWiki page title
commentNoReason for creating the page
contentModelNoType of content on the pagewikitext

Implementation Reference

  • Registers the 'create-page' tool with MCP server, defining input schema using Zod and linking to the handler function.
    export function createPageTool( server: McpServer ): RegisteredTool {
    	return server.tool(
    		'create-page',
    		'Creates a wiki page with the provided content.',
    		{
    			source: z.string().describe( 'Page content in the format specified by the contentModel parameter' ),
    			title: z.string().describe( 'Wiki page title' ),
    			comment: z.string().optional().describe( 'Reason for creating the page' ),
    			contentModel: z.string().optional().default( 'wikitext' ).describe( 'Type of content on the page' )
    		},
    		{
    			title: 'Create page',
    			readOnlyHint: false,
    			destructiveHint: true
    		} as ToolAnnotations,
    		async (
    			{ source, title, comment, contentModel }
    		) => handleCreatePageTool( source, title, comment, contentModel )
    	);
    }
  • Executes the tool: sends POST request to /v1/page endpoint with page data, handles errors, and returns success response.
    async function handleCreatePageTool(
    	source: string,
    	title: string,
    	comment?: string,
    	contentModel?: string
    ): Promise<CallToolResult> {
    	let data: MwRestApiPageObject;
    
    	try {
    		data = await makeRestPostRequest<MwRestApiPageObject>( '/v1/page', {
    			source: source,
    			title: title,
    			comment: formatEditComment( 'create-page', comment ),
    			// eslint-disable-next-line camelcase
    			content_model: contentModel
    		}, true );
    	} catch ( error ) {
    		return {
    			content: [
    				{ type: 'text', text: `Failed to create page: ${ ( error as Error ).message }` } as TextContent
    			],
    			isError: true
    		};
    	}
    
    	return {
    		content: createPageToolResult( data )
    	};
    }
  • Helper function to format the tool result content from the API response.
    function createPageToolResult( result: MwRestApiPageObject ): TextContent[] {
    	return [
    		{
    			type: 'text',
    			text: `Page created successfully: ${ getPageUrl( result.title ) }`
    		},
    		{
    			type: 'text',
    			text: [
    				'Page object:',
    				`Page ID: ${ result.id }`,
    				`Title: ${ result.title }`,
    				`Latest revision ID: ${ result.latest.id }`,
    				`Latest revision timestamp: ${ result.latest.timestamp }`,
    				`Content model: ${ result.content_model }`,
    				`License: ${ result.license.url } ${ result.license.title }`,
    				`HTML URL: ${ result.html_url }`
    			].join( '\n' )
    		}
    	];
    }
  • Registers all tools, including createPageTool, by calling each registrar function on the MCP server.
    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;
    }
  • Zod schema defining input parameters for the create-page tool.
    	source: z.string().describe( 'Page content in the format specified by the contentModel parameter' ),
    	title: z.string().describe( 'Wiki page title' ),
    	comment: z.string().optional().describe( 'Reason for creating the page' ),
    	contentModel: z.string().optional().default( 'wikitext' ).describe( 'Type of content on the page' )
    },
Behavior3/5

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

Annotations indicate readOnlyHint=false and destructiveHint=true, which the description aligns with by implying a write operation ('creates'). However, it doesn't add significant behavioral context beyond this, such as rate limits, authentication needs, or what 'destructive' entails (e.g., overwriting existing pages). The description doesn't contradict annotations but offers minimal extra insight.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and wastes no space, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a write operation with destructive hint) and lack of output schema, the description is somewhat incomplete. It doesn't explain return values or error conditions, and with annotations covering basic safety, it's adequate but leaves gaps in behavioral context for effective agent use.

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 description coverage is 100%, so the input schema fully documents all parameters. The description mentions 'provided content' but doesn't add meaning beyond what the schema specifies for parameters like 'source' or 'contentModel'. This meets the baseline for high schema coverage without extra param details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('creates') and resource ('wiki page'), specifying the action and target. However, it doesn't differentiate from siblings like 'add-wiki' or 'set-wiki', which might have overlapping functionality, leaving some ambiguity about when to choose this specific tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'add-wiki' or 'update-page'. The description lacks context about prerequisites, such as needing a wiki setup or permissions, and doesn't mention exclusions or specific scenarios for its use.

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