Skip to main content
Glama

search_work_items

Search for work items in Azure DevOps projects using WIQL queries to filter and retrieve specific tasks, bugs, or issues.

Instructions

Searches for work items using a WIQL (Work Item Query Language) query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesThe name or ID of the project.
wiql_queryYesThe Work Item Query Language (WIQL) query.

Implementation Reference

  • Core implementation of the search_work_items tool: executes WIQL query on Azure DevOps work item tracking client, filters by project if needed, retrieves matching work items, and formats results with id, title, state, and url.
    def search_work_items(self, project, wiql_query):
        # Add project filter to the WIQL query if not already present
        if "[System.TeamProject]" not in wiql_query and "WHERE" in wiql_query.upper():
            # Insert project filter into existing WHERE clause
            wiql_query = wiql_query.replace(" WHERE ", f" WHERE [System.TeamProject] = '{project}' AND ")
        elif "[System.TeamProject]" not in wiql_query:
            # Add WHERE clause with project filter
            wiql_query += f" WHERE [System.TeamProject] = '{project}'"
        
        wiql = Wiql(query=wiql_query)
        # Call query_by_wiql without the project parameter
        query_result = self.work_item_tracking_client.query_by_wiql(wiql)
        
        if query_result.work_items:
            work_item_ids = [item.id for item in query_result.work_items]
            work_items = self.work_item_tracking_client.get_work_items(ids=work_item_ids)
            return [
                {
                    "id": wi.id,
                    "title": wi.fields.get("System.Title"),
                    "state": wi.fields.get("System.State"),
                    "url": wi.url,
                }
                for wi in work_items
            ]
        else:
            return []
  • Registers the search_work_items tool with the MCP server by defining it in the tools list returned by list_tools(), including name, description, and input schema.
    types.Tool(
        name="search_work_items",
        description="Searches for work items using a WIQL (Work Item Query Language) query.",
        inputSchema={
            "type": "object",
            "properties": {
                "project": {
                    "type": "string", 
                    "description": "The name or ID of the project."
                },
                "wiql_query": {
                    "type": "string", 
                    "description": "The Work Item Query Language (WIQL) query."
                },
            },
            "required": ["project", "wiql_query"],
            "additionalProperties": False
        }
    ),
  • Dispatches the search_work_items tool call to the AzureDevOpsClient instance by passing arguments to client.search_work_items() within the _execute_tool method.
    elif name == "search_work_items":
        return self.client.search_work_items(**arguments)
  • Input schema definition for search_work_items tool, specifying required project and wiql_query parameters with types and descriptions.
    "properties": {
        "project": {
            "type": "string", 
            "description": "The name or ID of the project."
        },
        "wiql_query": {
            "type": "string", 
            "description": "The Work Item Query Language (WIQL) query."
        },
    },
    "required": ["project", "wiql_query"],
    "additionalProperties": False
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the search action without detailing what the search returns (e.g., list of items, fields included), pagination behavior, error handling, or authentication needs. For a search tool with no annotation coverage, this is a significant gap in transparency.

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 front-loaded with the core purpose and uses clear terminology. Every word earns its place, making it easy to parse quickly without unnecessary elaboration.

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 complexity of a search operation with no annotations and no output schema, the description is incomplete. It doesn't explain what the search returns, how results are formatted, or any limitations (e.g., query complexity, result limits). For a tool with two required parameters and behavioral uncertainty, this leaves critical gaps for an AI agent.

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 description mentions 'using a WIQL query,' which aligns with the 'wiql_query' parameter but doesn't add meaning beyond the schema's 100% coverage. It doesn't explain WIQL syntax, provide examples, or clarify the 'project' parameter's role. With high schema coverage, the baseline is 3, as the description adds minimal value over the structured data.

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 tool's purpose: 'Searches for work items using a WIQL (Work Item Query Language) query.' It specifies the verb ('searches'), resource ('work items'), and method ('using a WIQL query'), making it easy to understand. However, it doesn't explicitly differentiate from sibling tools like 'get_work_item' or 'search_wiki_pages', which would require a 5.

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 prefer this over 'get_work_item' (for single items) or 'search_wiki_pages' (for wiki content), nor does it specify prerequisites like needing a project context or valid WIQL syntax. This leaves the agent with minimal context for tool selection.

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/xrmghost/mcp-azure-devops'

If you have feedback or need assistance with the MCP directory API, please join our Discord server