create_wiki_page
Automate wiki page creation in Azure DevOps with a structured input system, specifying project, wiki name, path, and content for streamlined documentation.
Instructions
Create a new wiki page
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Content of the wiki page | |
| path | Yes | Path of the wiki page | |
| project | Yes | Name of the Azure DevOps project | |
| wiki | Yes | Name of the wiki |
Input Schema (JSON Schema)
{
"properties": {
"content": {
"description": "Content of the wiki page",
"type": "string"
},
"path": {
"description": "Path of the wiki page",
"type": "string"
},
"project": {
"description": "Name of the Azure DevOps project",
"type": "string"
},
"wiki": {
"description": "Name of the wiki",
"type": "string"
}
},
"required": [
"project",
"wiki",
"path",
"content"
],
"type": "object"
}
Implementation Reference
- src/tools/wiki.ts:15-69 (handler)The core handler function that executes the logic for creating a wiki page in Azure DevOps, including wiki creation if needed, parameter validation, and API calls.export async function createWikiPage(rawParams: any) { // Parse arguments with defaults from environment variables const params = createWikiPageSchema.parse({ project: rawParams.project || DEFAULT_PROJECT, wiki: rawParams.wiki, path: rawParams.path, content: rawParams.content, }); console.error("[API] Creating wiki page:", params.path); try { // First try to get all wikis in the project const wikiListUrl = `${ORG_URL}/${params.project}/_wiki/wikis/${params.wiki}?api-version=7.1-preview.1`; console.error("[API] Getting wikis from:", wikiListUrl); const wikis = await makeAzureDevOpsRequest(wikiListUrl); console.error("[API] Found wikis:", wikis); // Try to find existing wiki let wiki = wikis.value.find((w: any) => w.name === params.wiki); if (!wiki) { // Create new project wiki console.error("[API] Creating new project wiki"); const createWikiUrl = `${ORG_URL}/${params.project}/_wiki/wikis?api-version=7.1-preview.1`; wiki = await makeAzureDevOpsRequest(createWikiUrl, "POST", { name: `${params.wiki}.wiki`, projectId: params.project, type: "projectWiki", }); console.error("[API] Created wiki:", wiki); } // Create the page using REST API const pageUrl = `${ORG_URL}/${params.project}/_wiki/wikis/${ wiki.id }/pages?path=${encodeURIComponent(params.path)}&api-version=7.1-preview.1`; const page = await makeAzureDevOpsRequest(pageUrl, "PUT", { content: params.content, }); console.error("[API] Created page:", page); return { content: [ { type: "text", text: JSON.stringify(page, null, 2), }, ], }; } catch (error) { logError("Error creating wiki page", error); throw error; } }
- src/schemas/wiki.ts:6-13 (schema)Zod schema definition for input parameters of create_wiki_page tool, used for runtime validation in the handler.export const createWikiPageSchema = z.object({ project: z.string(), wiki: z.string(), path: z.string(), content: z.string(), }); export type CreateWikiPageParams = z.infer<typeof createWikiPageSchema>;
- src/tools/wiki.ts:134-159 (registration)Tool registration object defining the name, description, and input schema for create_wiki_page, part of wikiTools array used by the MCP server.{ name: "create_wiki_page", description: "Create a new wiki page", inputSchema: { type: "object", properties: { project: { type: "string", description: "Name of the Azure DevOps project", }, wiki: { type: "string", description: "Name of the wiki", }, path: { type: "string", description: "Path of the wiki page", }, content: { type: "string", description: "Content of the wiki page", }, }, required: ["project", "wiki", "path", "content"], }, },
- src/index.ts:50-63 (registration)MCP server handler for listing tools, which includes the wikiTools containing create_wiki_page.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ // Work Items ...workItemTools, // Pull Requests ...pullRequestTools, // Wiki ...wikiTools, // Projects ...projectTools, ], }; });
- src/index.ts:91-92 (registration)Dispatch case in the main CallToolRequest handler that routes calls to create_wiki_page to the handler function.case "create_wiki_page": return await createWikiPage(request.params.arguments || {});