Skip to main content
Glama
uright

Azure DevOps Wiki MCP Server

by uright

search_wiki

Search Azure DevOps wiki content using the Azure DevOps Search API to find relevant information across projects and organizations.

Instructions

Search across wiki content using Azure DevOps Search API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationNoAzure DevOps organization name
projectNoProject name
searchTextYesSearch query string
wikiIdNoOptional specific wiki identifier

Implementation Reference

  • Core handler implementation in AzureDevOpsWikiClient that performs the actual wiki search using Azure DevOps Search API, processes results into WikiSearchResult format.
    async searchWiki(request: WikiSearchRequest): Promise<WikiSearchResult[]> {
      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 searchApiUrl = `https://almsearch.dev.azure.com/${organization}/${project}/_apis/search/wikisearchresults?api-version=7.1`;
        
        interface WikiSearchRequestBody {
          searchText: string;
          $skip: number;
          $top: number;
          includeFacets: boolean;
          filters?: {
            Wiki?: string[];
          };
        }
    
        const requestBody: WikiSearchRequestBody = {
          searchText: request.searchText,
          $skip: 0,
          $top: 100, // Default to 100 results
          includeFacets: false
        };
    
        // Add wiki filter if specified
        if (request.wikiId) {
          requestBody.filters = {
            Wiki: [request.wikiId]
          };
        }
    
        const response = await this.connection.rest.client.post(searchApiUrl, JSON.stringify(requestBody), {
          'Content-Type': 'application/json'
        });
        
        if (!response.message || response.message.statusCode !== 200) {
          throw new Error(`Search failed: HTTP ${response.message?.statusCode || 'Unknown'}`);
        }
    
        const responseBody = await response.readBody();
        if (!responseBody) {
          return [];
        }
    
        const data = JSON.parse(responseBody);
        
        if (!data.results || !Array.isArray(data.results)) {
          return [];
        }
    
        interface WikiSearchResultItem {
          fileName?: string;
          path?: string;
          url?: string;
          matches?: {
            content?: { text: string }[];
          };
          project?: {
            name: string;
          };
          wiki?: {
            name: string;
          };
        }
    
        return data.results.map((result: WikiSearchResultItem) => ({
          title: result.fileName || (result.path ? result.path.split('/').pop() || 'Unknown' : 'Unknown'),
          url: result.url || '',
          content: result.matches && result.matches.content 
            ? result.matches.content.map((match) => match.text).join(' ')
            : '',
          project: result.project?.name || project,
          wiki: result.wiki?.name || request.wikiId || 'Unknown',
          pagePath: this.formatPagePath(result.path || '')
        }));
    
      } catch (error) {
        throw new Error(`Failed to search wiki: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • MCP server handler for 'search_wiki' tool: validates input with schema, initializes client with org/project, delegates to client.searchWiki, formats response.
    private async handleSearchWiki(args: any) {
      const request = WikiSearchRequestSchema.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 results = await client.searchWiki(request);
      
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(results, null, 2)
        }]
      };
    }
  • src/server.ts:31-55 (registration)
    Registration of 'search_wiki' tool in MCP server, including name, description, and input schema.
      name: 'search_wiki',
      description: 'Search across wiki content using Azure DevOps Search API',
      inputSchema: {
        type: 'object',
        properties: {
          organization: {
            type: 'string',
            description: 'Azure DevOps organization name'
          },
          project: {
            type: 'string',
            description: 'Project name'
          },
          searchText: {
            type: 'string',
            description: 'Search query string'
          },
          wikiId: {
            type: 'string',
            description: 'Optional specific wiki identifier'
          }
        },
        required: ['searchText']
      }
    },
  • Zod schema for input validation (WikiSearchRequestSchema) and TypeScript interface for output (WikiSearchResult) used in search_wiki.
    import { z } from 'zod';
    
    export const WikiSearchRequestSchema = z.object({
      organization: z.string().min(1).optional(),
      project: z.string().min(1).optional(),
      searchText: z.string().min(1),
      wikiId: z.string().optional(),
    });
    
    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(),
    });
    
    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),
    });
    
    export const WikiUpdatePageRequestSchema = z.object({
      organization: z.string().min(1).optional(),
      project: z.string().min(1).optional(),
      wikiId: z.string().min(1),
      path: z.string().min(1),
      content: z.string(),
    });
    
    export const WikiListRequestSchema = z.object({
      organization: z.string().min(1).optional(),
      project: z.string().min(1).optional(),
    });
    
    export type WikiSearchRequest = z.infer<typeof WikiSearchRequestSchema>;
    export type WikiPageTreeRequest = z.infer<typeof WikiPageTreeRequestSchema>;
    export type WikiGetPageRequest = z.infer<typeof WikiGetPageRequestSchema>;
    export type WikiUpdatePageRequest = z.infer<typeof WikiUpdatePageRequestSchema>;
    export type WikiListRequest = z.infer<typeof WikiListRequestSchema>;
    
    export interface WikiSearchResult {
      title: string;
      url: string;
      content: string;
      project: string;
      wiki: string;
      pagePath: string;
    }
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. It mentions using the 'Azure DevOps Search API', which implies a read operation, but doesn't specify if it's read-only, requires authentication, has rate limits, or what the output format is. This is a significant gap for a tool with no annotation coverage.

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 waste. It's appropriately sized and front-loaded, clearly stating the tool's purpose without unnecessary details.

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 tool's complexity (search functionality with 4 parameters), no annotations, and no output schema, the description is incomplete. It doesn't explain what the search returns, how results are formatted, or any behavioral traits, making it inadequate for the agent to use 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 input schema has 100% description coverage, so the schema already documents all four parameters. The description adds no additional meaning beyond what the schema provides, such as explaining how 'searchText' interacts with the API or when 'wikiId' is necessary. Baseline 3 is appropriate when 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 ('Search across wiki content') and the resource ('wiki content'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'list_wiki' or 'wiki_get_page_tree', which might also retrieve wiki content in different ways, so it doesn't reach the highest score.

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 to choose 'search_wiki' over 'list_wiki' for listing content or 'wiki_get_page' for retrieving specific pages, leaving the agent without usage context.

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