search_wiki
Find specific content in Azure DevOps Wiki by searching with keywords. Filter results by projects or wiki names, include facets, and control pagination for precise, organized outcomes.
Instructions
Search Azure DevOps Wiki for a given search text
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeFacets | No | Include facets in the search results | |
| project | No | Filter by projects | |
| searchText | Yes | Keywords to search for wiki pages | |
| skip | No | Number of results to skip | |
| top | No | Maximum number of results to return | |
| wiki | No | Filter by wiki names |
Implementation Reference
- src/tools/search.ts:93-130 (handler)Handler function for the 'search_wiki' tool that performs a search query against the Azure DevOps Wiki Search API using a POST request with filters.async ({ searchText, project, wiki, includeFacets, skip, top }) => { const accessToken = await tokenProvider(); const url = `https://almsearch.dev.azure.com/${orgName}/_apis/search/wikisearchresults?api-version=${apiVersion}`; const requestBody: Record<string, unknown> = { searchText, includeFacets, $skip: skip, $top: top, }; const filters: Record<string, string[]> = {}; if (project && project.length > 0) filters.Project = project; if (wiki && wiki.length > 0) filters.Wiki = wiki; if (Object.keys(filters).length > 0) { requestBody.filters = filters; } const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${accessToken.token}`, "User-Agent": userAgentProvider(), }, body: JSON.stringify(requestBody), }); if (!response.ok) { throw new Error(`Azure DevOps Wiki Search API error: ${response.status} ${response.statusText}`); } const result = await response.text(); return { content: [{ type: "text", text: result }], }; }
- src/tools/search.ts:85-92 (schema)Zod schema defining the input parameters for the 'search_wiki' tool.{ searchText: z.string().describe("Keywords to search for wiki pages"), project: z.array(z.string()).optional().describe("Filter by projects"), wiki: z.array(z.string()).optional().describe("Filter by wiki names"), includeFacets: z.boolean().default(false).describe("Include facets in the search results"), skip: z.number().default(0).describe("Number of results to skip"), top: z.number().default(10).describe("Maximum number of results to return"), },
- src/tools/search.ts:82-131 (registration)Registration of the 'search_wiki' tool using McpServer's server.tool method, including name, description, schema, and handler.server.tool( SEARCH_TOOLS.search_wiki, "Search Azure DevOps Wiki for a given search text", { searchText: z.string().describe("Keywords to search for wiki pages"), project: z.array(z.string()).optional().describe("Filter by projects"), wiki: z.array(z.string()).optional().describe("Filter by wiki names"), includeFacets: z.boolean().default(false).describe("Include facets in the search results"), skip: z.number().default(0).describe("Number of results to skip"), top: z.number().default(10).describe("Maximum number of results to return"), }, async ({ searchText, project, wiki, includeFacets, skip, top }) => { const accessToken = await tokenProvider(); const url = `https://almsearch.dev.azure.com/${orgName}/_apis/search/wikisearchresults?api-version=${apiVersion}`; const requestBody: Record<string, unknown> = { searchText, includeFacets, $skip: skip, $top: top, }; const filters: Record<string, string[]> = {}; if (project && project.length > 0) filters.Project = project; if (wiki && wiki.length > 0) filters.Wiki = wiki; if (Object.keys(filters).length > 0) { requestBody.filters = filters; } const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${accessToken.token}`, "User-Agent": userAgentProvider(), }, body: JSON.stringify(requestBody), }); if (!response.ok) { throw new Error(`Azure DevOps Wiki Search API error: ${response.status} ${response.statusText}`); } const result = await response.text(); return { content: [{ type: "text", text: result }], }; } );
- src/tools/search.ts:14-18 (helper)Constant defining the tool names, including 'search_wiki' used in registration.const SEARCH_TOOLS = { search_code: "search_code", search_wiki: "search_wiki", search_workitem: "search_workitem", };