Skip to main content
Glama
uright

Azure DevOps Wiki MCP Server

by uright

wiki_get_page_tree

Retrieve hierarchical page structure from Azure DevOps wikis to navigate content organization and relationships.

Instructions

Retrieve hierarchical page structure from wiki

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationNoAzure DevOps organization name
projectNoProject name
wikiIdYesWiki identifier
depthNoOptional maximum depth to retrieve

Implementation Reference

  • src/server.ts:56-81 (registration)
    Tool registration definition including name, description, and input schema for listTools endpoint.
    { name: 'wiki_get_page_tree', description: 'Retrieve hierarchical page structure from wiki', inputSchema: { type: 'object', properties: { organization: { type: 'string', description: 'Azure DevOps organization name' }, project: { type: 'string', description: 'Project name' }, wikiId: { type: 'string', description: 'Wiki identifier' }, depth: { type: 'number', description: 'Optional maximum depth to retrieve' } }, required: ['wikiId'] } },
  • Zod schema definition for input validation of wiki_get_page_tree tool requests.
    export const WikiPageTreeRequestSchema = z.object({ organization: z.string().min(1).optional(), project: z.string().min(1).optional(), wikiId: z.string().min(1), depth: z.number().int().positive().optional(), });
  • MCP server handler that parses arguments, initializes client if needed, calls client.getPageTree, and formats response.
    private async handleGetPageTree(args: any) { const request = WikiPageTreeRequestSchema.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 tree = await client.getPageTree(request); return { content: [{ type: 'text', text: JSON.stringify(tree, null, 2) }] }; }
  • Primary implementation: constructs API URL for wiki pages tree, fetches from Azure DevOps, normalizes response structure, recursively processes into typed hierarchical WikiPageNode tree with sorting.
    async getPageTree(request: WikiPageTreeRequest): Promise<WikiPageNode[]> { 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 recursionLevel = request.depth ? 'Full' : 'OneLevel'; const apiUrl = `${orgUrl}/${project}/_apis/wiki/wikis/${request.wikiId}/pages?recursionLevel=${recursionLevel}&api-version=7.1`; const response = await this.connection.rest.client.get(apiUrl); if (!response.message || response.message.statusCode !== 200) { return []; } const responseBody = await response.readBody(); if (!responseBody) { return []; } const data = JSON.parse(responseBody); let pages = []; if (data.value) { pages = data.value; } else if (data.subPages) { pages = [data]; } else { pages = [data]; } const processPages = (pageList: unknown[]): WikiPageNode[] => { return pageList.map((page: unknown) => { const pageData = page as { id?: number; path?: string; order?: number; gitItemPath?: string; subPages?: unknown[] }; return { id: pageData.id?.toString() || '', path: pageData.path || '', title: pageData.path ? pageData.path.split('/').pop() || '' : '', order: pageData.order || 0, gitItemPath: pageData.gitItemPath || '', subPages: pageData.subPages ? processPages(pageData.subPages) : [] }; }).sort((a, b) => a.order - b.order); }; return processPages(pages); } catch (error) { throw new Error(`Failed to get page tree: ${error instanceof Error ? error.message : String(error)}`); } }
  • src/server.ts:167-168 (registration)
    Switch case dispatching CallToolRequest for 'wiki_get_page_tree' to the handler method.
    case 'wiki_get_page_tree': return await this.handleGetPageTree(args);

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