update_wiki_page
Modify Azure DevOps wiki pages by updating content in markdown format with optional comments for tracking changes.
Instructions
Update content of a wiki page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | No | The ID or name of the organization (Default: mycompany) | |
| projectId | No | The ID or name of the project (Default: MyProject) | |
| wikiId | Yes | The ID or name of the wiki | |
| pagePath | Yes | Path of the wiki page to update | |
| content | Yes | The new content for the wiki page in markdown format | |
| comment | No | Optional comment for the update |
Implementation Reference
- The main handler function that executes the logic to update a wiki page using the Azure DevOps wiki client.export async function updateWikiPage(options: UpdateWikiPageOptions) { const validatedOptions = UpdateWikiPageSchema.parse(options); const { organizationId, projectId, wikiId, pagePath, content, comment } = validatedOptions; // Create the client const client = await azureDevOpsClient.getWikiClient({ organizationId: organizationId ?? defaultOrg, }); // Prepare the wiki page content const wikiPageContent = { content, }; // Update the wiki page const updatedPage = await client.updatePage( wikiPageContent, projectId ?? defaultProject, wikiId, pagePath, { comment: comment ?? undefined, }, ); return updatedPage; }
- Zod schema defining the input parameters and validation for the update_wiki_page tool.export const UpdateWikiPageSchema = 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().min(1).describe('Path of the wiki page to update'), content: z .string() .min(1) .describe('The new content for the wiki page in markdown format'), comment: z .string() .optional() .nullable() .describe('Optional comment for the update'), });
- src/features/wikis/tool-definitions.ts:29-33 (registration)Tool definition registration in the wikis tools array, specifying name, description, and input schema.{ name: 'update_wiki_page', description: 'Update content of a wiki page', inputSchema: zodToJsonSchema(UpdateWikiPageSchema), },
- src/features/wikis/index.ts:95-107 (registration)Dispatching logic in the wikis request handler that invokes updateWikiPage for the 'update_wiki_page' tool name.case 'update_wiki_page': { const args = UpdateWikiPageSchema.parse(request.params.arguments); const result = await updateWikiPage({ 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) }], };
- src/features/wikis/index.ts:4-4 (registration)Export statement registering the handler and schema from the update-wiki-page feature module.export { updateWikiPage, UpdateWikiPageSchema } from './update-wiki-page';