Open Context Protocol is live! 🚀 Read the launch post

gitGetRef

Get a reference

Details

  • Method: GET
  • Path: /repos/{owner}/{repo}/git/ref/{ref}
  • Operation ID: git/get-ref

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"
  },
  "ref": {
    "description": "The Git reference. For more information, see \"[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)\" in the Git documentation.",
    "required": true,
    "location": "path",
    "type": "string"
  }
}

Response Schema

{
  "title": "Git Reference",
  "description": "Git references within a repository",
  "type": "object",
  "properties": {
    "ref": {
      "type": "string"
    },
    "node_id": {
      "type": "string"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "object": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        },
        "sha": {
          "description": "SHA for the reference",
          "example": "7638417db6d59f3c431d3e1f261cc637155684cd",
          "type": "string",
          "minLength": 40,
          "maxLength": 40
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "type",
        "sha",
        "url"
      ]
    }
  },
  "required": [
    "ref",
    "node_id",
    "url",
    "object"
  ]
}

Usage

from ocp_agent import OCPAgent

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

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