GitHub Tool
Connection Setup GuideThe GitHub tool provides a comprehensive interface for interacting with your repositories. It allows your AI agent to manage issues, pull requests, and repository files programmatically.
Key Use Cases:
- Automated Issue Management: Create new bug reports or feature requests directly from a chat or another integrated tool.
- Code-Aware Agents: Enable your agent to list files in a repository, read the contents of specific files, and even add comments to issues with code context.
- PR Summarization: Fetch details, changed files, and the diff of a pull request to generate summaries or conduct reviews.
github_tool.get_pr_details
Get details of a pull request by its number.
Parameters
Name | Type | Description |
---|---|---|
pr_number |
integer |
The number of the pull request. |
curl -X POST https://toolstream.dev/v1/tools/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.get_pr_details",
"arguments": {
"pr_number": {
"type": "integer",
"description": "The number of the pull request."
}
}
}
}'
import requests
import json
API_KEY = "YOUR_API_KEY"
TOOLSTREAM_URL = "https://toolstream.dev/v1/tools/execute"
payload = {
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.get_pr_details",
"arguments": {
"pr_number": {
"type": "integer",
"description": "The number of the pull request."
}
}
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(TOOLSTREAM_URL, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
result = response.json()
print(json.dumps(result, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
github_tool.get_issue
Get details of an issue by its number.
Parameters
Name | Type | Description |
---|---|---|
issue_number |
integer |
The number of the issue. |
curl -X POST https://toolstream.dev/v1/tools/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.get_issue",
"arguments": {
"issue_number": {
"type": "integer",
"description": "The number of the issue."
}
}
}
}'
import requests
import json
API_KEY = "YOUR_API_KEY"
TOOLSTREAM_URL = "https://toolstream.dev/v1/tools/execute"
payload = {
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.get_issue",
"arguments": {
"issue_number": {
"type": "integer",
"description": "The number of the issue."
}
}
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(TOOLSTREAM_URL, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
result = response.json()
print(json.dumps(result, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
github_tool.create_issue
Creates a new issue in the configured repository.
Parameters
Name | Type | Description |
---|---|---|
title |
string |
The title of the issue. |
body |
string |
Optional. The main content or description of the issue. |
curl -X POST https://toolstream.dev/v1/tools/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.create_issue",
"arguments": {
"title": {
"type": "string",
"description": "The title of the issue."
},
"body": {
"type": "string",
"description": "Optional. The main content or description of the issue."
}
}
}
}'
import requests
import json
API_KEY = "YOUR_API_KEY"
TOOLSTREAM_URL = "https://toolstream.dev/v1/tools/execute"
payload = {
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.create_issue",
"arguments": {
"title": {
"type": "string",
"description": "The title of the issue."
},
"body": {
"type": "string",
"description": "Optional. The main content or description of the issue."
}
}
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(TOOLSTREAM_URL, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
result = response.json()
print(json.dumps(result, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
github_tool.add_comment_to_issue
Adds a new comment to an existing issue in the repository.
Parameters
Name | Type | Description |
---|---|---|
issue_number |
integer |
The number of the issue to comment on. |
comment_body |
string |
The content of the comment in Markdown format. |
curl -X POST https://toolstream.dev/v1/tools/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.add_comment_to_issue",
"arguments": {
"issue_number": {
"type": "integer",
"description": "The number of the issue to comment on."
},
"comment_body": {
"type": "string",
"description": "The content of the comment in Markdown format."
}
}
}
}'
import requests
import json
API_KEY = "YOUR_API_KEY"
TOOLSTREAM_URL = "https://toolstream.dev/v1/tools/execute"
payload = {
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.add_comment_to_issue",
"arguments": {
"issue_number": {
"type": "integer",
"description": "The number of the issue to comment on."
},
"comment_body": {
"type": "string",
"description": "The content of the comment in Markdown format."
}
}
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(TOOLSTREAM_URL, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
result = response.json()
print(json.dumps(result, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
github_tool.list_repository_files
Lists the files and directories in the repository at a specific path.
Parameters
Name | Type | Description |
---|---|---|
path |
string |
The path to list contents for. Use an empty string or '/' for the root directory. |
curl -X POST https://toolstream.dev/v1/tools/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.list_repository_files",
"arguments": {
"path": {
"type": "string",
"description": "The path to list contents for. Use an empty string or '/' for the root directory."
}
}
}
}'
import requests
import json
API_KEY = "YOUR_API_KEY"
TOOLSTREAM_URL = "https://toolstream.dev/v1/tools/execute"
payload = {
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.list_repository_files",
"arguments": {
"path": {
"type": "string",
"description": "The path to list contents for. Use an empty string or '/' for the root directory."
}
}
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(TOOLSTREAM_URL, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
result = response.json()
print(json.dumps(result, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
github_tool.get_file_content
Retrieves the content of a specific file from the repository.
Parameters
Name | Type | Description |
---|---|---|
file_path |
string |
The full path to the file from the root of the repository, e.g., 'src/main.py'. |
curl -X POST https://toolstream.dev/v1/tools/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.get_file_content",
"arguments": {
"file_path": {
"type": "string",
"description": "The full path to the file from the root of the repository, e.g., 'src/main.py'."
}
}
}
}'
import requests
import json
API_KEY = "YOUR_API_KEY"
TOOLSTREAM_URL = "https://toolstream.dev/v1/tools/execute"
payload = {
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "github_tool.get_file_content",
"arguments": {
"file_path": {
"type": "string",
"description": "The full path to the file from the root of the repository, e.g., 'src/main.py'."
}
}
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(TOOLSTREAM_URL, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
result = response.json()
print(json.dumps(result, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)