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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Retrieve' implies a read-only operation, it doesn't specify whether this requires authentication, what format the hierarchical structure returns in (e.g., tree, list), or any rate limits or constraints beyond the parameters. The description is too minimal for a tool with 4 parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's front-loaded with the core purpose ('Retrieve hierarchical page structure'), making it easy to scan and understand quickly. Every word earns its place, achieving optimal conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (4 parameters, no output schema, no annotations), the description is incomplete. It doesn't explain what the hierarchical structure looks like, how it's returned, or any behavioral aspects like error handling. For a tool that retrieves structured data without an output schema, more context is needed to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with all parameters clearly documented in the input schema (e.g., 'organization' as Azure DevOps organization name). The description adds no additional parameter semantics beyond what's in the schema, such as explaining how 'depth' affects the hierarchy or what 'wikiId' corresponds to. Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Retrieve') and resource ('hierarchical page structure from wiki'), making the tool's purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'wiki_get_page' (which likely retrieves individual pages) or 'list_wiki' (which might list wikis rather than page structures).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when this hierarchical retrieval is appropriate compared to 'wiki_get_page' for single pages or 'search_wiki' for content searches, nor does it specify any prerequisites or exclusions for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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