Skip to main content
Glama
mmruesch12
by mmruesch12

list_work_items

Retrieve and filter work items in an Azure DevOps project by type, state, or assigned user to streamline project management and task tracking.

Instructions

List work items in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assignedToNoFilter by assigned user
projectYesName of the Azure DevOps project
statesNoFilter by states
typesNoFilter by work item types

Implementation Reference

  • The handler function that implements the core logic for listing work items using Azure DevOps WIQL query, fetching details, and returning formatted response.
    export async function listWorkItems(rawParams: any) {
      // Parse arguments with defaults from environment variables
      const params = listWorkItemsSchema.parse({
        project: rawParams.project || DEFAULT_PROJECT,
        types: rawParams.types,
        states: rawParams.states,
        assignedTo: rawParams.assignedTo,
      });
    
      console.error("[API] Listing work items:", params);
    
      try {
        // Get the Work Item Tracking API client
        const witClient = await getWorkItemClient();
    
        // Build WIQL query
        let wiql = `SELECT [System.Id], [System.Title], [System.State], [System.WorkItemType], [System.AssignedTo] FROM WorkItems WHERE [System.TeamProject] = '${params.project}'`;
    
        if (params.types && params.types.length > 0) {
          wiql += ` AND [System.WorkItemType] IN ('${params.types.join("','")}')`;
        }
    
        if (params.states && params.states.length > 0) {
          wiql += ` AND [System.State] IN ('${params.states.join("','")}')`;
        }
    
        if (params.assignedTo) {
          wiql += ` AND [System.AssignedTo] = '${params.assignedTo}'`;
        }
    
        // Execute the query
        const queryResult = await witClient.queryByWiql({ query: wiql });
    
        if (!queryResult.workItems) {
          return {
            content: [{ type: "text", text: JSON.stringify([], null, 2) }],
          };
        }
    
        // Get full work item details
        const workItems = await witClient.getWorkItems(
          queryResult.workItems.map(
            (wi: WorkItemInterfaces.WorkItemReference) => wi.id!
          ),
          undefined,
          undefined
        );
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(workItems, null, 2),
            },
          ],
        };
      } catch (error) {
        logError("Error listing work items", error);
        throw error;
      }
    }
  • Zod schema for validating input parameters to listWorkItems function, with project required and others optional.
    export const listWorkItemsSchema = z.object({
      project: z.string(),
      types: z.array(z.string()).optional(),
      states: z.array(z.string()).optional(),
      assignedTo: z.string().optional(),
    });
    
    export type ListWorkItemsParams = z.infer<typeof listWorkItemsSchema>;
  • src/index.ts:69-70 (registration)
    Registration of the tool handler in the MCP server's CallToolRequestSchema switch statement.
    case "list_work_items":
      return await listWorkItems(request.params.arguments || {});
  • Tool definition object exported in workItemTools array, used for MCP ListTools response defining the tool's name, description, and input schema.
    {
      name: "list_work_items",
      description: "List work items in a project",
      inputSchema: {
        type: "object",
        properties: {
          project: {
            type: "string",
            description: "Name of the Azure DevOps project",
          },
          types: {
            type: "array",
            items: { type: "string" },
            description: "Filter by work item types",
          },
          states: {
            type: "array",
            items: { type: "string" },
            description: "Filter by states",
          },
          assignedTo: {
            type: "string",
            description: "Filter by assigned user",
          },
        },
        required: ["project"],
      },
    },
  • src/index.ts:50-63 (registration)
    MCP server handler for ListToolsRequestSchema that includes workItemTools in the tools list for registration.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          // Work Items
          ...workItemTools,
          // Pull Requests
          ...pullRequestTools,
          // Wiki
          ...wikiTools,
          // Projects
          ...projectTools,
        ],
      };
    });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('List') but doesn't describe whether this is a read-only operation, if it requires authentication, what the return format looks like (e.g., pagination, fields included), or any rate limits. This is a significant gap for a tool with multiple parameters and no output schema.

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 action and resource, making it appropriately sized for its purpose 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 (4 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain behavioral aspects like safety, return values, or usage context. While the schema covers parameters well, the lack of annotations and output schema means the description should provide more context to be fully helpful.

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?

Schema description coverage is 100%, so the schema already documents all parameters (assignedTo, project, states, types) with descriptions. The description adds no additional meaning beyond implying filtering capabilities, which is already covered in the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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 verb ('List') and resource ('work items in a project'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get_work_item' (which retrieves a single item) or 'list_projects' (which lists projects instead of work items), missing explicit sibling distinction.

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 sibling tools like 'get_work_item' for single items or 'list_projects' for projects, nor does it specify prerequisites or context for filtering work items, leaving usage unclear.

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

Related 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/mmruesch12/azdo-mcp'

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