Skip to main content
Glama

create-page

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' ) },

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