Skip to main content
Glama

Azure DevOps Wiki MCP Server

by uright

wiki_get_page

Retrieve specific wiki page content from Azure DevOps using organization, project, wiki ID, and page path or ID for efficient content access and management.

Instructions

Get content of a specific wiki page

Input Schema

NameRequiredDescriptionDefault
organizationNoAzure DevOps organization name
pathYesPage path or page ID
projectNoProject name
wikiIdYesWiki identifier

Input Schema (JSON Schema)

{ "properties": { "organization": { "description": "Azure DevOps organization name", "type": "string" }, "path": { "description": "Page path or page ID", "type": "string" }, "project": { "description": "Project name", "type": "string" }, "wikiId": { "description": "Wiki identifier", "type": "string" } }, "required": [ "wikiId", "path" ], "type": "object" }

Implementation Reference

  • MCP tool handler for wiki_get_page: parses input, initializes client if needed, calls client.getPage, and returns JSON response.
    private async handleGetPage(args: any) { const request = WikiGetPageRequestSchema.parse(args); const organization = request.organization || this.config.defaultOrganization; const project = request.project || this.config.defaultProject; if (!organization) { throw new Error('Organization is required either as parameter or in server configuration'); } if (!project) { throw new Error('Project is required either as parameter or in server configuration'); } const client = await this.getClient(organization, project); const page = await client.getPage(request); return { content: [{ type: 'text', text: JSON.stringify(page, null, 2) }] }; }
  • Core implementation that performs the HTTP GET to Azure DevOps Wiki API to retrieve page content and parses the response into WikiPageContent.
    async getPage(request: WikiGetPageRequest): Promise<WikiPageContent> { if (!this.wikiApi || !this.connection) { throw new Error('Azure DevOps client not initialized'); } try { const organization = request.organization || this.config.organization; const project = request.project || this.config.project; if (!organization || !project) { throw new Error('Organization and project must be provided'); } const orgUrl = this.config.azureDevOpsUrl || `https://dev.azure.com/${organization}`; const encodedPath = encodeURIComponent(request.path); const apiUrl = `${orgUrl}/${project}/_apis/wiki/wikis/${request.wikiId}/pages?path=${encodedPath}&includeContent=true&api-version=7.1`; const response = await this.connection.rest.client.get(apiUrl); if (!response.message || response.message.statusCode !== 200) { throw new Error(`Failed to get page: HTTP ${response.message?.statusCode || 'Unknown'}`); } const responseBody = await response.readBody(); if (!responseBody) { throw new Error('Empty response body'); } const data = JSON.parse(responseBody); // Handle the response structure let pageData; if (data.value) { // If value is an array, get the first element if (Array.isArray(data.value) && data.value.length > 0) { pageData = data.value[0]; } else if (Array.isArray(data.value) && data.value.length === 0) { // Empty array means page not found throw new Error(`Page not found: ${request.path}`); } else { // value is not an array, use it directly pageData = data.value; } } else { // No value property, use data directly pageData = data; } if (!pageData || pageData === null) { throw new Error(`Page not found: ${request.path}`); } return { id: pageData.id?.toString() || '', path: pageData.path || request.path, title: pageData.path ? pageData.path.split('/').pop() || '' : '', content: pageData.content || '', gitItemPath: pageData.gitItemPath || '', order: pageData.order || 0, version: pageData.version || '', isParentPage: pageData.isParentPage || false }; } catch (error) { throw new Error(`Failed to get page: ${error instanceof Error ? error.message : String(error)}`); } }
  • Zod schema for validating wiki_get_page tool input parameters.
    export const WikiGetPageRequestSchema = z.object({ organization: z.string().min(1).optional(), project: z.string().min(1).optional(), wikiId: z.string().min(1), path: z.string().min(1), });
  • src/server.ts:82-107 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema for wiki_get_page.
    { name: 'wiki_get_page', description: 'Get content of a specific wiki page', inputSchema: { type: 'object', properties: { organization: { type: 'string', description: 'Azure DevOps organization name' }, project: { type: 'string', description: 'Project name' }, wikiId: { type: 'string', description: 'Wiki identifier' }, path: { type: 'string', description: 'Page path or page ID' } }, required: ['wikiId', 'path'] } },
  • TypeScript type inferred from the WikiGetPageRequestSchema.
    export type WikiGetPageRequest = z.infer<typeof WikiGetPageRequestSchema>;

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/uright/azure-devops-wiki-mcp'

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