Skip to main content
Glama
skurekjakub

Git Stuff Server

by skurekjakub

ado_pr_threads

Retrieves active comment threads from an Azure DevOps Pull Request using the Pull Request ID, enabling efficient review and collaboration.

Instructions

Fetches all active comment threads from an Azure DevOps Pull Request.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationIdNoOptional organization identifier to load specific configuration settings.
pullRequestIdYesThe numeric ID of the Pull Request (as a string).

Implementation Reference

  • The main handler function that executes the 'ado_pr_threads' tool logic, fetching active comment threads from an Azure DevOps Pull Request.
    export const adoPrThreadsHandler = async (input: AdoPrThreadsRequest): Promise<CallToolResult> => {
      console.log("[AdoPrThreadsTool] Received request:", input);
      try {
        const config = await getAdoConfig(input.organizationId);
    
        if (!config.organization || !config.project) {
          return {
            content: [{ type: "text", text: "ERROR: Missing required configuration parameters (organization, project). Please ensure Azure CLI is authenticated and configuration is set." }],
            isError: true,
          };
        }
    
        const { gitApi } = await getAdoConnectionAndApi(config.organization);
        const pullRequestIdNum = parseInt(input.pullRequestId, 10);
    
        if (isNaN(pullRequestIdNum)) {
            return { 
                content: [{ type: "text", text: "ERROR: pullRequestId must be a numeric string." }], 
                isError: true 
            };
        }
    
        const pr = await getPrDetails(gitApi, pullRequestIdNum, config.project);
        if (!pr || !pr.repository?.id) {
          return { 
            content: [{ type: "text", text: "ERROR: Could not retrieve valid PR details or repository ID." }], 
            isError: true 
          };
        }
        const repositoryId = pr.repository.id;
    
        const activeThreads: GitInterfaces.GitPullRequestCommentThread[] = await getActivePrThreads(
          gitApi,
          repositoryId,
          pullRequestIdNum,
          config.project
        );
    
        console.log(`[AdoPrThreadsTool] Found ${activeThreads.length} active threads.`);
    
        return {
          content: [{ type: "text", text: JSON.stringify(activeThreads, null, 2) }],
        };
    
      } catch (error: any) {
        console.error("[AdoPrThreadsTool] Error:", error);
        return {
          content: [{ type: "text", text: `ERROR: Failed to get active PR threads. ${error.message}` }],
          isError: true,
        };
      }
    };
  • Zod schema defining the input parameters for the 'ado_pr_threads' tool: pullRequestId and optional organizationId.
    export const AdoPrThreadsRequestSchema = z.object({
      pullRequestId: z.string().min(1).regex(/^\d+$/, "pullRequestId must be a numeric string.")
        .describe("The numeric ID of the Pull Request (as a string)."),
      organizationId: z.string().min(1).optional()
        .describe("Optional organization identifier to load specific configuration settings."),
    });
  • Registration of the 'ado_pr_threads' tool with the MCP server, including name, description, schema, and handler.
    server.tool(
      "ado_pr_threads",
      "Fetches all active comment threads from an Azure DevOps Pull Request.",
      AdoPrThreadsRequestSchema.shape, // Use .shape here for Zod schema
      adoPrThreadsHandler
    );
  • Core helper function that fetches all comment threads for a PR and filters for active ones, used by the handler.
    export async function getActivePrThreads(
      gitApi: GitApi,
      repositoryId: string,
      pullRequestId: number,
      project: string
    ): Promise<GitInterfaces.GitPullRequestCommentThread[]> {
      const threads = await gitApi.getThreads(repositoryId, pullRequestId, project);
      
      // Filter for active threads. CommentThreadStatus.Active = 1
      // Adjust if the actual enum value is different or if a more direct status check is available.
      return threads.filter(thread => thread.status === GitInterfaces.CommentThreadStatus.Active);
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It states it 'fetches' data, implying a read-only operation, but doesn't clarify authentication needs, rate limits, pagination, error handling, or what 'active' entails (e.g., unresolved threads only). For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior and constraints.

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 that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse. Every element earns its place, and there's no redundancy or fluff, achieving optimal conciseness.

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 fetching PR threads, lack of annotations, and no output schema, the description is incomplete. It doesn't explain what 'active' means, the return format (e.g., list of threads with comments), or any behavioral aspects like permissions or errors. For a tool with no structured support, more detail is needed to ensure the agent can use it effectively without guesswork.

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%, with clear documentation for both parameters: 'pullRequestId' (required numeric ID) and 'organizationId' (optional for configuration). The description adds no additional parameter semantics beyond what the schema provides, such as format examples or usage tips. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 action ('fetches') and resource ('all active comment threads from an Azure DevOps Pull Request'), making the purpose immediately understandable. It distinguishes from sibling tools like 'ado_pr_changes' (which likely fetches code changes) and 'ado_pr_comment' (which likely creates comments). However, it doesn't explicitly mention how it differs from 'git_merge_diff' or specify what 'active' means in this context.

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 like 'ado_pr_comment' (for commenting) or 'git_merge_diff' (for diff analysis). It doesn't mention prerequisites, such as needing access to the Azure DevOps instance, or contextual factors like whether it's for review workflows. The absence of usage context leaves the agent to infer based on tool names alone.

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/skurekjakub/GitStuffServer'

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