Skip to main content
Glama
Tiberriver256

Azure DevOps MCP Server

list_commits

Retrieve recent commits from a branch with file-level diff content to track code changes in Azure DevOps repositories.

Instructions

List recent commits on a branch including file-level diff content for each commit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoThe ID or name of the project (Default: MyProject)
organizationIdNoThe ID or name of the organization (Default: mycompany)
repositoryIdYesThe ID or name of the repository
branchNameYesBranch name to list commits from
topNoMaximum number of commits to return (Default: 10)
skipNoNumber of commits to skip from the newest

Implementation Reference

  • The core handler function implementing the list_commits tool. Fetches commits from a branch, retrieves changes, generates patches for modified files using Azure DevOps Git API.
    export async function listCommits(
      connection: WebApi,
      options: ListCommitsOptions,
    ): Promise<ListCommitsResponse> {
      try {
        const gitApi = await connection.getGitApi();
        const commits = await gitApi.getCommits(
          options.repositoryId,
          {
            itemVersion: {
              version: options.branchName,
              versionType: GitVersionType.Branch,
            },
            $top: options.top ?? 10,
            $skip: options.skip,
          },
          options.projectId,
        );
    
        if (!commits || commits.length === 0) {
          return { commits: [] };
        }
    
        const getBlobText = async (objId?: string): Promise<string> => {
          if (!objId) {
            return '';
          }
          const stream = await gitApi.getBlobContent(
            options.repositoryId,
            objId,
            options.projectId,
          );
          return stream ? await streamToString(stream) : '';
        };
    
        const commitsWithContent: CommitWithContent[] = [];
    
        for (const commit of commits) {
          const commitId = commit.commitId;
          if (!commitId) {
            continue;
          }
    
          const commitChanges = await gitApi.getChanges(
            commitId,
            options.repositoryId,
            options.projectId,
          );
          const changeEntries = commitChanges?.changes ?? [];
    
          const files = await Promise.all(
            changeEntries.map(async (entry: GitChange) => {
              const path = entry.item?.path || entry.originalPath || '';
              const [oldContent, newContent] = await Promise.all([
                getBlobText(entry.item?.originalObjectId),
                getBlobText(entry.item?.objectId),
              ]);
              const patch = createTwoFilesPatch(
                entry.originalPath || path,
                path,
                oldContent,
                newContent,
              );
              return { path, patch };
            }),
          );
    
          commitsWithContent.push({
            commitId,
            comment: commit.comment,
            author: commit.author,
            committer: commit.committer,
            url: commit.url,
            parents: commit.parents,
            files,
          });
        }
    
        return { commits: commitsWithContent };
      } catch (error) {
        if (error instanceof AzureDevOpsError) {
          throw error;
        }
        throw new Error(
          `Failed to list commits: ${error instanceof Error ? error.message : String(error)}`,
        );
      }
    }
  • Zod schema defining the input parameters for the list_commits tool.
    export const ListCommitsSchema = z.object({
      projectId: z
        .string()
        .optional()
        .describe(`The ID or name of the project (Default: ${defaultProject})`),
      organizationId: z
        .string()
        .optional()
        .describe(`The ID or name of the organization (Default: ${defaultOrg})`),
      repositoryId: z.string().describe('The ID or name of the repository'),
      branchName: z.string().describe('Branch name to list commits from'),
      top: z
        .number()
        .int()
        .min(1)
        .max(100)
        .optional()
        .describe('Maximum number of commits to return (Default: 10)'),
      skip: z
        .number()
        .int()
        .min(0)
        .optional()
        .describe('Number of commits to skip from the newest'),
    });
  • Tool definition registration for the list_commits tool in the repositories tools array.
    {
      name: 'list_commits',
      description:
        'List recent commits on a branch including file-level diff content for each commit',
      inputSchema: zodToJsonSchema(ListCommitsSchema),
    },
  • Dispatcher handler case that validates input with schema and invokes the listCommits function.
    case 'list_commits': {
      const args = ListCommitsSchema.parse(request.params.arguments);
      const result = await listCommits(connection, {
        ...args,
        projectId: args.projectId ?? defaultProject,
      });
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
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. It mentions 'including file-level diff content for each commit,' which adds some behavioral context beyond a simple list. However, it lacks details on permissions, rate limits, pagination (beyond 'top' and 'skip' parameters), error handling, or output format, leaving significant gaps for a read operation with potential complexity.

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 front-loads the core functionality. It avoids redundancy and wastes no words, making it easy to parse quickly while conveying essential information about the tool's scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (6 parameters, no annotations, no output schema), the description is minimally adequate. It covers the basic action and output inclusion ('file-level diff content'), but lacks details on behavioral traits, error cases, or output structure. For a tool with no annotations or output schema, more context would be beneficial to fully guide usage.

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 fully documents all 6 parameters. The description adds minimal value beyond the schema by implying 'recent commits' and 'file-level diff content,' but does not elaborate on parameter interactions or semantics. With high schema coverage, the baseline score of 3 is appropriate as the description does not significantly enhance parameter understanding.

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: 'List recent commits on a branch including file-level diff content for each commit.' It specifies the verb ('list'), resource ('commits'), and scope ('on a branch'), but does not explicitly differentiate from sibling tools like 'create_commit' or 'get_repository_tree' beyond the listing focus.

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 does not mention prerequisites (e.g., authentication), exclusions, or comparisons to similar tools like 'get_repository_tree' or 'search_code' that might overlap in functionality. Usage is implied by the action but not explicitly defined.

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

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