Skip to main content
Glama

create_wiki_page

Create or update wiki pages in Azure DevOps to document processes, share knowledge, and maintain project documentation using markdown content.

Instructions

Create a new page in a wiki. If the page already exists at the specified path, it will be updated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationIdNoThe ID or name of the organization (Default: mycompany)
projectIdNoThe ID or name of the project (Default: MyProject)
wikiIdYesThe ID or name of the wiki
pagePathNoPath of the wiki page to create. If the path does not exist, it will be created. Defaults to the wiki root (/). Example: /ParentPage/NewPage/
contentYesThe content for the new wiki page in markdown format
commentNoOptional comment for the creation or update

Implementation Reference

  • The core handler function that implements the logic to create or update a wiki page in Azure DevOps using the wiki client or direct API call.
    export const createWikiPage = async ( params: z.infer<typeof CreateWikiPageSchema>, client?: { defaults?: { organizationId?: string; projectId?: string }; put: ( url: string, data: Record<string, unknown>, ) => Promise<{ data: unknown }>; }, // For testing purposes only ) => { try { const { organizationId, projectId, wikiId, pagePath, content, comment } = params; // For testing mode, use the client's defaults if (client && client.defaults) { const org = organizationId ?? client.defaults.organizationId; const project = projectId ?? client.defaults.projectId; if (!org) { throw new Error( 'Organization ID is not defined. Please provide it or set a default.', ); } // This branch is for testing only const apiUrl = `${org}/${ project ? `${project}/` : '' }_apis/wiki/wikis/${wikiId}/pages?path=${encodeURIComponent( pagePath ?? '/', )}&api-version=7.1-preview.1`; // Prepare the request body const requestBody: Record<string, unknown> = { content }; if (comment) { requestBody.comment = comment; } // Make the API request const response = await client.put(apiUrl, requestBody); return response.data; } else { // Use default organization and project if not provided const org = organizationId ?? defaultOrg; const project = projectId ?? defaultProject; if (!org) { throw new Error( 'Organization ID is not defined. Please provide it or set a default.', ); } // Create the client const wikiClient = await azureDevOpsClient.getWikiClient({ organizationId: org, }); // Prepare the wiki page content const wikiPageContent = { content, }; // This is the real implementation return await wikiClient.updatePage( wikiPageContent, project, wikiId, pagePath ?? '/', { comment: comment ?? undefined, }, ); } } catch (error: unknown) { throw await handleRequestError( error, 'Failed to create or update wiki page', ); } };
  • Zod schema defining the input parameters and validation for the create_wiki_page tool.
    export const CreateWikiPageSchema = z.object({ organizationId: z .string() .optional() .nullable() .describe(`The ID or name of the organization (Default: ${defaultOrg})`), projectId: z .string() .optional() .nullable() .describe(`The ID or name of the project (Default: ${defaultProject})`), wikiId: z.string().min(1).describe('The ID or name of the wiki'), pagePath: z .string() .optional() .nullable() .default('/') .describe( 'Path of the wiki page to create. If the path does not exist, it will be created. Defaults to the wiki root (/). Example: /ParentPage/NewPage', ), content: z .string() .min(1) .describe('The content for the new wiki page in markdown format'), comment: z .string() .optional() .describe('Optional comment for the creation or update'), });
  • MCP tool definition registration specifying the name, description, and input schema for create_wiki_page.
    { name: 'create_wiki_page', description: 'Create a new page in a wiki. If the page already exists at the specified path, it will be updated.', inputSchema: zodToJsonSchema(CreateWikiPageSchema), },
  • Dispatch/registration in the wikis request handler that parses arguments and calls the createWikiPage handler.
    case 'create_wiki_page': { const args = CreateWikiPageSchema.parse(request.params.arguments); const result = await createWikiPage({ organizationId: args.organizationId ?? defaultOrg, projectId: args.projectId ?? defaultProject, wikiId: args.wikiId, pagePath: args.pagePath, content: args.content, comment: args.comment, }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }

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/Tiberriver256/mcp-server-azure-devops'

If you have feedback or need assistance with the MCP directory API, please join our Discord server