Open Context Protocol is live! 🚀 Read the launch post

gitCreateRef

Create a reference

Details

  • Method: POST
  • Path: /repos/{owner}/{repo}/git/refs
  • Operation ID: git/create-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 name of the fully qualified reference (ie: `refs/heads/master`). If it doesn't start with 'refs' and have at least two slashes, it will be rejected.",
    "required": true,
    "location": "body",
    "type": "string"
  },
  "sha": {
    "description": "The SHA1 value for this reference.",
    "required": true,
    "location": "body",
    "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('gitCreateRef', {
    # Add required parameters here
})