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

reposCreateDeployKey

Create a deploy key

Details

  • Method: POST
  • Path: /repos/{owner}/{repo}/keys
  • Operation ID: repos/create-deploy-key

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"
  },
  "title": {
    "description": "A name for the key.",
    "required": false,
    "location": "body",
    "type": "string"
  },
  "key": {
    "description": "The contents of the key.",
    "required": true,
    "location": "body",
    "type": "string"
  },
  "read_only": {
    "description": "If `true`, the key will only be able to read repository contents. Otherwise, the key will be able to read and write.  \n  \nDeploy keys with write access can perform the same actions as an organization member with admin access, or a collaborator on a personal repository. For more information, see \"[Repository permission levels for an organization](https://docs.github.com/articles/repository-permission-levels-for-an-organization/)\" and \"[Permission levels for a user account repository](https://docs.github.com/articles/permission-levels-for-a-user-account-repository/).\"",
    "required": false,
    "location": "body",
    "type": "boolean"
  }
}

Response Schema

{
  "title": "Deploy Key",
  "description": "An SSH key granting access to a single repository.",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "key": {
      "type": "string"
    },
    "url": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "verified": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string"
    },
    "read_only": {
      "type": "boolean"
    },
    "added_by": {
      "type": "string",
      "nullable": true
    },
    "last_used": {
      "nullable": true,
      "type": "string",
      "format": "date-time"
    },
    "enabled": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "key",
    "url",
    "title",
    "verified",
    "created_at",
    "read_only"
  ]
}

Usage

from ocp_agent import OCPAgent

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

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