Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

build_get_log

Retrieve build logs from Azure DevOps by specifying the project and build ID, enabling efficient troubleshooting and monitoring of build processes with PAT authentication.

Instructions

Retrieves the logs for a specific build.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
buildIdYesID of the build to get the log for
projectYesProject ID or name to get the build log for

Implementation Reference

  • The handler function for the 'build_get_log' tool. It retrieves the build logs using the Azure DevOps Build API's getBuildLogs method for the given project and buildId, then returns the logs as JSON.
    async ({ project, buildId }) => {
      const connection = await connectionProvider();
      const buildApi = await connection.getBuildApi();
      const logs = await buildApi.getBuildLogs(project, buildId);
    
      return {
        content: [{ type: "text", text: JSON.stringify(logs, null, 2) }],
      };
    }
  • Zod schema defining the input parameters: project (string) and buildId (number) for the 'build_get_log' tool.
    {
      project: z.string().describe("Project ID or name to get the build log for"),
      buildId: z.number().describe("ID of the build to get the log for"),
    },
  • Registration of the 'build_get_log' tool via server.tool call, referencing BUILD_TOOLS.get_log which maps to 'build_get_log'.
    server.tool(
      BUILD_TOOLS.get_log,
      "Retrieves the logs for a specific build.",
      {
        project: z.string().describe("Project ID or name to get the build log for"),
        buildId: z.number().describe("ID of the build to get the log for"),
      },
      async ({ project, buildId }) => {
        const connection = await connectionProvider();
        const buildApi = await connection.getBuildApi();
        const logs = await buildApi.getBuildLogs(project, buildId);
    
        return {
          content: [{ type: "text", text: JSON.stringify(logs, null, 2) }],
        };
      }
    );
  • BUILD_TOOLS constant defining the tool name mappings, including get_log: 'build_get_log'.
    const BUILD_TOOLS = {
      get_definitions: "build_get_definitions",
      get_definition_revisions: "build_get_definition_revisions",
      get_builds: "build_get_builds",
      get_log: "build_get_log",
      get_log_by_id: "build_get_log_by_id",
      get_changes: "build_get_changes",
      run_build: "build_run_build",
      get_status: "build_get_status",
      update_build_stage: "build_update_build_stage",
    };
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/ennuiii/DevOpsMcpPAT'

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