wit_get_query
Retrieve a specific query by its ID or path from an Azure DevOps project. Customize the response with options to expand details, adjust depth, include deleted items, and use ISO date format.
Instructions
Get a query by its ID or path.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | Optional depth parameter to specify how deep to expand the query. Defaults to 0. | |
| expand | No | Optional expand parameter to include additional details in the response. Defaults to 'None'. | |
| includeDeleted | No | Whether to include deleted items in the query results. Defaults to false. | |
| project | Yes | The name or ID of the Azure DevOps project. | |
| query | Yes | The ID or path of the query to retrieve. | |
| useIsoDateFormat | No | Whether to use ISO date format in the response. Defaults to false. |
Implementation Reference
- src/tools/workitems.ts:618-627 (handler)The handler function that executes the logic for the wit_get_query tool, retrieving query details from Azure DevOps WorkItemTrackingApi.async ({ project, query, expand, depth, includeDeleted, useIsoDateFormat }) => { const connection = await connectionProvider(); const workItemApi = await connection.getWorkItemTrackingApi(); const queryDetails = await workItemApi.getQuery(project, query, safeEnumConvert(QueryExpand, expand), depth, includeDeleted, useIsoDateFormat); return { content: [{ type: "text", text: JSON.stringify(queryDetails, null, 2) }], }; }
- src/tools/workitems.ts:607-617 (schema)Zod input schema defining parameters for the wit_get_query tool.{ project: z.string().describe("The name or ID of the Azure DevOps project."), query: z.string().describe("The ID or path of the query to retrieve."), expand: z .enum(getEnumKeys(QueryExpand) as [string, ...string[]]) .optional() .describe("Optional expand parameter to include additional details in the response. Defaults to 'None'."), depth: z.number().default(0).describe("Optional depth parameter to specify how deep to expand the query. Defaults to 0."), includeDeleted: z.boolean().default(false).describe("Whether to include deleted items in the query results. Defaults to false."), useIsoDateFormat: z.boolean().default(false).describe("Whether to use ISO date format in the response. Defaults to false."), },
- src/tools/workitems.ts:604-628 (registration)Registration of the wit_get_query tool (via WORKITEM_TOOLS.get_query) on the McpServer instance, including schema and handler.server.tool( WORKITEM_TOOLS.get_query, "Get a query by its ID or path.", { project: z.string().describe("The name or ID of the Azure DevOps project."), query: z.string().describe("The ID or path of the query to retrieve."), expand: z .enum(getEnumKeys(QueryExpand) as [string, ...string[]]) .optional() .describe("Optional expand parameter to include additional details in the response. Defaults to 'None'."), depth: z.number().default(0).describe("Optional depth parameter to specify how deep to expand the query. Defaults to 0."), includeDeleted: z.boolean().default(false).describe("Whether to include deleted items in the query results. Defaults to false."), useIsoDateFormat: z.boolean().default(false).describe("Whether to use ISO date format in the response. Defaults to false."), }, async ({ project, query, expand, depth, includeDeleted, useIsoDateFormat }) => { const connection = await connectionProvider(); const workItemApi = await connection.getWorkItemTrackingApi(); const queryDetails = await workItemApi.getQuery(project, query, safeEnumConvert(QueryExpand, expand), depth, includeDeleted, useIsoDateFormat); return { content: [{ type: "text", text: JSON.stringify(queryDetails, null, 2) }], }; } );
- src/tools/workitems.ts:26-26 (registration)Constant mapping defining the MCP tool name 'wit_get_query' for the get_query tool.get_query: "wit_get_query",