Open Context Protocol is live! 🚀 Read the launch post
codeScanningListAlertInstances

codeScanningListAlertInstances

List instances of a code scanning alert

Details

  • Method: GET
  • Path: /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances
  • Operation ID: code-scanning/list-alert-instances

Parameters

{
  "owner": {
    "description": "The account owner of the repository. The name is not case sensitive.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "repo": {
    "description": "The name of the repository without the `.git` extension. The name is not case sensitive.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "alert_number": {
    "description": "The number that identifies an alert. You can find this at the end of the URL for a code scanning alert within GitHub, and in the `number` field in the response from the `GET /repos/{owner}/{repo}/code-scanning/alerts` operation.",
    "required": true,
    "location": "path",
    "type": "integer"
  },
  "page": {
    "description": "The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "per_page": {
    "description": "The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "ref": {
    "description": "The Git reference for the results you want to list. The `ref` for a branch can be formatted either as `refs/heads/<branch name>` or simply `<branch name>`. To reference a pull request use `refs/pull/<number>/merge`.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "pr": {
    "description": "The number of the pull request for the results you want to list.",
    "required": false,
    "location": "query",
    "type": "integer"
  }
}

Response Schema

{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "ref": {
        "type": "string",
        "description": "The Git reference, formatted as `refs/pull/<number>/merge`, `refs/pull/<number>/head`,\n`refs/heads/<branch name>` or simply `<branch name>`."
      },
      "analysis_key": {
        "type": "string",
        "description": "Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name."
      },
      "environment": {
        "type": "string",
        "description": "Identifies the variable values associated with the environment in which the analysis that generated this alert instance was performed, such as the language that was analyzed."
      },
      "category": {
        "type": "string",
        "description": "Identifies the configuration under which the analysis was executed. Used to distinguish between multiple analyses for the same tool and commit, but performed on different languages or different parts of the code."
      },
      "state": {
        "type": "string",
        "description": "State of a code scanning alert instance.",
        "nullable": true,
        "enum": [
          "open",
          "fixed"
        ]
      },
      "commit_sha": {
        "type": "string"
      },
      "message": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          }
        }
      },
      "location": {
        "type": "object",
        "description": "Describe a region within a file for the alert.",
        "properties": {
          "path": {
            "type": "string"
          },
          "start_line": {
            "type": "integer"
          },
          "end_line": {
            "type": "integer"
          },
          "start_column": {
            "type": "integer"
          },
          "end_column": {
            "type": "integer"
          }
        }
      },
      "html_url": {
        "type": "string"
      },
      "classifications": {
        "type": "array",
        "description": "Classifications that have been applied to the file that triggered the alert.\nFor example identifying it as documentation, or a generated file.",
        "items": {
          "type": "string",
          "description": "A classification of the file. For example to identify it as generated.",
          "nullable": true,
          "enum": [
            "source",
            "generated",
            "test",
            "library"
          ]
        }
      }
    }
  }
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('github')

# Call this tool
result = await agent.call_tool('codeScanningListAlertInstances', {
    # Add required parameters here
})