Skip to main content
Glama

Azure DevOps Wiki MCP Server

by uright

search_wiki

Enables AI agents to search Azure DevOps wiki content using the search API. Supports queries across organizations, projects, and specific wikis for targeted information retrieval.

Instructions

Search across wiki content using Azure DevOps Search API

Input Schema

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

Input Schema (JSON Schema)

{ "properties": { "organization": { "description": "Azure DevOps organization name", "type": "string" }, "project": { "description": "Project name", "type": "string" }, "searchText": { "description": "Search query string", "type": "string" }, "wikiId": { "description": "Optional specific wiki identifier", "type": "string" } }, "required": [ "searchText" ], "type": "object" }

Implementation Reference

  • Core implementation of the search_wiki tool: performs API call to Azure DevOps wiki search endpoint, processes and maps results to standardized 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)}`); } }
  • Server-side handler wrapper for search_wiki: validates input with schema, obtains client, calls core searchWiki, formats response for MCP.
    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:30-55 (registration)
    Tool registration in ListTools response: defines name, description, and input schema for search_wiki.
    { 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 of search_wiki request parameters.
    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(), });
  • Type definition for output results of search_wiki.
    export interface WikiSearchResult { title: string; url: string; content: string; project: string; wiki: string; pagePath: string; }

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