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

licensesGetForRepo

Get the license for a repository

Details

  • Method: GET
  • Path: /repos/{owner}/{repo}/license
  • Operation ID: licenses/get-for-repo

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 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"
  }
}

Response Schema

{
  "title": "License Content",
  "description": "License Content",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "path": {
      "type": "string"
    },
    "sha": {
      "type": "string"
    },
    "size": {
      "type": "integer"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "html_url": {
      "type": "string",
      "format": "uri",
      "nullable": true
    },
    "git_url": {
      "type": "string",
      "format": "uri",
      "nullable": true
    },
    "download_url": {
      "type": "string",
      "format": "uri",
      "nullable": true
    },
    "type": {
      "type": "string"
    },
    "content": {
      "type": "string"
    },
    "encoding": {
      "type": "string"
    },
    "_links": {
      "type": "object",
      "properties": {
        "git": {
          "type": "string",
          "format": "uri",
          "nullable": true
        },
        "html": {
          "type": "string",
          "format": "uri",
          "nullable": true
        },
        "self": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "git",
        "html",
        "self"
      ]
    },
    "license": {
      "title": "License Simple",
      "description": "License Simple",
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "example": "mit"
        },
        "name": {
          "type": "string",
          "example": "MIT License"
        },
        "url": {
          "type": "string",
          "nullable": true,
          "format": "uri",
          "example": "https://api.github.com/licenses/mit"
        },
        "spdx_id": {
          "type": "string",
          "nullable": true,
          "example": "MIT"
        },
        "node_id": {
          "type": "string",
          "example": "MDc6TGljZW5zZW1pdA=="
        },
        "html_url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "key",
        "name",
        "url",
        "spdx_id",
        "node_id"
      ],
      "nullable": true
    }
  },
  "required": [
    "_links",
    "git_url",
    "html_url",
    "download_url",
    "name",
    "path",
    "sha",
    "size",
    "type",
    "url",
    "content",
    "encoding",
    "license"
  ]
}

Usage

from ocp_agent import OCPAgent

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

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