Open Context Protocol is live! πŸš€ Read the launch post

reposGetContent

Get repository content

Details

  • Method: GET
  • Path: /repos/{owner}/{repo}/contents/{path}
  • Operation ID: repos/get-content

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"
  },
  "path": {
    "description": "path parameter",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "ref": {
    "description": "The name of the commit/branch/tag. Default: the repository’s default branch.",
    "required": false,
    "location": "query",
    "type": "string"
  }
}

Response Schema

{
  "oneOf": [
    {
      "title": "Content Directory",
      "description": "A list of directory items",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "dir",
              "file",
              "submodule",
              "symlink"
            ]
          },
          "size": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "sha": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "git_url": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "html_url": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "download_url": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "_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"
            ]
          }
        },
        "required": [
          "_links",
          "git_url",
          "html_url",
          "download_url",
          "name",
          "path",
          "sha",
          "size",
          "type",
          "url"
        ]
      }
    },
    {
      "title": "Content File",
      "description": "Content File",
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "file"
          ]
        },
        "encoding": {
          "type": "string"
        },
        "size": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "sha": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "git_url": {
          "type": "string",
          "format": "uri",
          "nullable": true
        },
        "html_url": {
          "type": "string",
          "format": "uri",
          "nullable": true
        },
        "download_url": {
          "type": "string",
          "format": "uri",
          "nullable": true
        },
        "_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"
          ]
        },
        "target": {
          "type": "string",
          "example": "\"actual/actual.md\""
        },
        "submodule_git_url": {
          "type": "string",
          "example": "\"git://example.com/defunkt/dotjs.git\""
        }
      },
      "required": [
        "_links",
        "git_url",
        "html_url",
        "download_url",
        "name",
        "path",
        "sha",
        "size",
        "type",
        "url",
        "content",
        "encoding"
      ]
    },
    {
      "title": "Symlink Content",
      "description": "An object describing a symlink",
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "symlink"
          ]
        },
        "target": {
          "type": "string"
        },
        "size": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "sha": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "git_url": {
          "type": "string",
          "format": "uri",
          "nullable": true
        },
        "html_url": {
          "type": "string",
          "format": "uri",
          "nullable": true
        },
        "download_url": {
          "type": "string",
          "format": "uri",
          "nullable": true
        },
        "_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"
          ]
        }
      },
      "required": [
        "_links",
        "git_url",
        "html_url",
        "download_url",
        "name",
        "path",
        "sha",
        "size",
        "type",
        "url",
        "target"
      ]
    },
    {
      "title": "Submodule Content",
      "description": "An object describing a submodule",
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "submodule"
          ]
        },
        "submodule_git_url": {
          "type": "string",
          "format": "uri"
        },
        "size": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "sha": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "git_url": {
          "type": "string",
          "format": "uri",
          "nullable": true
        },
        "html_url": {
          "type": "string",
          "format": "uri",
          "nullable": true
        },
        "download_url": {
          "type": "string",
          "format": "uri",
          "nullable": true
        },
        "_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"
          ]
        }
      },
      "required": [
        "_links",
        "git_url",
        "html_url",
        "download_url",
        "name",
        "path",
        "sha",
        "size",
        "type",
        "url",
        "submodule_git_url"
      ]
    }
  ]
}

Usage

from ocp_agent import OCPAgent

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

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