Skip to main content
Glama

create-page

Create a wiki page by specifying title, content, and optional details like comment and content model using the MCP server for MediaWiki.

Instructions

Creates a wiki page with the provided content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commentNoReason for creating the page
contentModelNoType of content on the page. Defaults to "wikitext"
sourceYesPage content in the format specified by the contentModel parameter
titleYesWiki page title

Implementation Reference

  • Registers the 'create-page' tool with the MCP server, including input schema, annotations, and handler reference.
    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 ) ); }
  • Core execution logic: POSTs to /v1/page API endpoint to create the wiki page, handles errors, and delegates success formatting.
    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 ) }; }
  • Zod input schema defining parameters: source, title, optional comment and contentModel.
    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' ) },
  • Formats the API response into a detailed TextContent array for the tool output.
    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' ) } ]; }
  • Overall tool registration function that calls createPageTool among others.
    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; }

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