Skip to main content
Glama
mmruesch12
by mmruesch12

get_work_item

Retrieve detailed information about a specific work item in Azure DevOps by providing the project name and work item ID.

Instructions

Get details of a specific work item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the work item
projectYesName of the Azure DevOps project

Implementation Reference

  • The handler function that implements the core logic of the 'get_work_item' tool: parses input with Zod, fetches WIT client, retrieves work item by ID from Azure DevOps, and returns formatted JSON response.
    export async function getWorkItem(rawParams: any) {
      // Parse arguments with defaults from environment variables
      const params = getWorkItemSchema.parse({
        project: rawParams.project || DEFAULT_PROJECT,
        id: rawParams.id,
      });
    
      console.error("[API] Getting work item details:", params);
    
      try {
        // Get the Work Item Tracking API client
        const witClient = await getWorkItemClient();
    
        // Get work item details
        const workItem = await witClient.getWorkItem(
          params.id,
          undefined,
          undefined
        );
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(workItem, null, 2),
            },
          ],
        };
      } catch (error) {
        logError("Error getting work item", error);
        throw error;
      }
    }
  • Zod schema for input validation and TypeScript type definition used in the getWorkItem handler.
    export const getWorkItemSchema = z.object({
      project: z.string(),
      id: z.number(),
    });
    
    export type GetWorkItemParams = z.infer<typeof getWorkItemSchema>;
  • Tool registration metadata including name, description, and input schema definition within the workItemTools array exported for use in MCP server.
    {
      name: "get_work_item",
      description: "Get details of a specific work item",
      inputSchema: {
        type: "object",
        properties: {
          project: {
            type: "string",
            description: "Name of the Azure DevOps project",
          },
          id: {
            type: "number",
            description: "ID of the work item",
          },
        },
        required: ["project", "id"],
      },
    },
  • src/index.ts:71-72 (registration)
    Dispatch logic in the MCP server's CallToolRequest handler that routes 'get_work_item' calls to the getWorkItem implementation.
    case "get_work_item":
      return await getWorkItem(request.params.arguments || {});
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