gitCreateTree
Create a tree
Details
- Method:
POST - Path:
/repos/{owner}/{repo}/git/trees - Operation ID:
git/create-tree
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"
},
"tree": {
"description": "Objects (of `path`, `mode`, `type`, and `sha`) specifying a tree structure.",
"required": true,
"location": "body",
"type": "array"
},
"base_tree": {
"description": "The SHA1 of an existing Git tree object which will be used as the base for the new tree. If provided, a new Git tree object will be created from entries in the Git tree object pointed to by `base_tree` and entries defined in the `tree` parameter. Entries defined in the `tree` parameter will overwrite items from `base_tree` with the same `path`. If you're creating new changes on a branch, then normally you'd set `base_tree` to the SHA1 of the Git tree object of the current latest commit on the branch you're working on.\nIf not provided, GitHub will create a new Git tree object from only the entries defined in the `tree` parameter. If you create a new commit pointing to such a tree, then all files which were a part of the parent commit's tree and were not defined in the `tree` parameter will be listed as deleted by the new commit.",
"required": false,
"location": "body",
"type": "string"
}
}Response Schema
{
"title": "Git Tree",
"description": "The hierarchy between files in a Git repository.",
"type": "object",
"properties": {
"sha": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"truncated": {
"type": "boolean"
},
"tree": {
"description": "Objects specifying a tree structure",
"type": "array",
"items": {
"type": "object",
"required": [
"path",
"mode",
"type",
"sha"
],
"properties": {
"path": {
"type": "string",
"example": "test/file.rb"
},
"mode": {
"type": "string",
"example": "040000"
},
"type": {
"type": "string",
"example": "tree"
},
"sha": {
"type": "string",
"example": "23f6827669e43831def8a7ad935069c8bd418261"
},
"size": {
"type": "integer",
"example": 12
},
"url": {
"type": "string",
"example": "https://api.github.com/repos/owner-482f3203ecf01f67e9deb18e/BBB_Private_Repo/git/blobs/23f6827669e43831def8a7ad935069c8bd418261"
}
}
},
"example": [
{
"path": "file.rb",
"mode": "100644",
"type": "blob",
"size": 30,
"sha": "44b4fc6d56897b048c772eb4087f854f46256132",
"url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132"
}
]
}
},
"required": [
"sha",
"tree",
"truncated"
]
}Usage
from ocp_agent import OCPAgent
agent = OCPAgent()
await agent.register_api('github')
# Call this tool
result = await agent.call_tool('gitCreateTree', {
# Add required parameters here
})