Skip to main content
Glama
uright

Azure DevOps Wiki MCP Server

by uright

wiki_get_page_tree

Retrieve hierarchical page tree from an Azure DevOps wiki, showing page structure and order.

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

  • Handler function that parses the request with WikiPageTreeRequestSchema, gets the client, calls client.getPageTree(), and returns the result as JSON.
    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)
        }]
      };
    }
  • Zod schema for WikiPageTreeRequest: validates organization (optional), project (optional), wikiId (required), depth (optional positive integer).
    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(),
    });
  • Client method getPageTree() that makes the actual REST API call to Azure DevOps Wiki pages endpoint, handles recursion level based on depth, processes the hierarchical page nodes, and returns WikiPageNode[].
    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:56-81 (registration)
    Tool registration in the ListToolsRequestSchema handler: defines name 'wiki_get_page_tree', description, and inputSchema for the tool.
    {
      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']
      }
    },
  • src/server.ts:167-168 (registration)
    Switch-case dispatch in CallToolRequestSchema handler that routes 'wiki_get_page_tree' to handleGetPageTree().
    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?

No annotations, so description must carry behavioral transparency. It only states a read operation but lacks details on auth, errors, or effects.

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

Conciseness4/5

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

Single, concise sentence with no wasted words, but it is too brief for sufficient context.

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 no output schema and four parameters, the description lacks details on return structure, depth behavior, and required parameters beyond wikiId.

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?

Schema coverage is 100% with descriptions for all parameters; description adds little beyond confirming it retrieves hierarchical structure.

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

Purpose5/5

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

The description clearly states the tool retrieves hierarchical page structure, distinguishing it from siblings that list wikis, search, get a single page, or update.

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?

No guidance on when to use this tool versus alternatives like wiki_get_page for single pages; no when-not or context provided.

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