ado_query_wiql
Execute custom WIQL queries in Azure DevOps to retrieve work items, supporting detailed results for project management and reporting tasks.
Instructions
Ejecuta una consulta WIQL personalizada en Azure DevOps
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wiql | Yes | Query WIQL completa | |
| getDetails | No | Si es true, obtiene los detalles completos de cada Work Item |
Implementation Reference
- src/index.ts:368-396 (handler)The handler function for the ado_query_wiql tool, which executes a WIQL query against Azure DevOps using the Work Item Tracking API.
async ({ wiql, getDetails }) => { const api = await getWitApi(); const wiqlQuery: witInterfaces.Wiql = { query: wiql }; const teamContext = { project: currentProject }; const queryResult = await api.queryByWiql(wiqlQuery, teamContext); const workItemRefs = queryResult.workItems || []; if (workItemRefs.length === 0) { return { content: [{ type: "text", text: "No se encontraron resultados" }], }; } if (!getDetails) { return { content: [{ type: "text", text: formatWorkItemList(workItemRefs) }], }; } const ids = workItemRefs.map((wi) => wi.id!).filter((id): id is number => id !== undefined); const workItems = await api.getWorkItems(ids); const result = workItems.map((wi) => formatWorkItem(wi)).join("\n---\n"); return { content: [{ type: "text", text: result }], }; } - src/index.ts:358-367 (registration)Registration of the ado_query_wiql tool with its schema definition in the MCP server.
server.tool( "ado_query_wiql", "Ejecuta una consulta WIQL personalizada en Azure DevOps", { wiql: z.string().describe("Query WIQL completa"), getDetails: z .boolean() .optional() .describe("Si es true, obtiene los detalles completos de cada Work Item"), },