Skip to main content
Glama

search_work_items

Search for Azure DevOps work items using WIQL queries to find specific tasks, bugs, or user stories within a project.

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 handler function that executes WIQL query against Azure DevOps, adds project filter if needed, retrieves matching work item details.
    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 []
  • Defines the input schema and description for the search_work_items tool, including required parameters project and wiql_query.
    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 } ),
  • Registers all tools including search_work_items by returning the self.tools list in response to MCP list_tools request.
    @self.server.list_tools() async def list_tools() -> List[types.Tool]: """Return the list of available tools.""" logger.info(f"Tools requested - returning {len(self.tools)} tools") self.tools_registered = True return self.tools
  • Dispatch handler in server that forwards arguments to the client.search_work_items method.
    elif name == "search_work_items": return self.client.search_work_items(**arguments)

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