Skip to content

Add toolsnaps for every tool #543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/toolsnaps/toolsnaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func Test(toolName string, tool any) error {
diff := toolNode.Diff(snapNode, jd.SET).Render()
if diff != "" {
// If there is a difference, we return an error with the diff
return fmt.Errorf("tool schema for %s has changed unexpectedly:\n%s", toolName, diff)
return fmt.Errorf("tool schema for %s has changed unexpectedly:\n%s\nrun with `UPDATE_TOOLSNAPS=true` if this is expected", toolName, diff)
}

return nil
Expand Down
9 changes: 9 additions & 0 deletions internal/toolsnaps/toolsnaps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func TestSnapshotDoesNotExistNotInCI(t *testing.T) {

func TestSnapshotDoesNotExistInCI(t *testing.T) {
withIsolatedWorkingDir(t)
// Ensure that UPDATE_TOOLSNAPS is not set for this test, which it might be if someone is running
// UPDATE_TOOLSNAPS=true go test ./...
t.Setenv("UPDATE_TOOLSNAPS", "false")

// Given we are running in CI
t.Setenv("GITHUB_ACTIONS", "true")
Expand Down Expand Up @@ -74,6 +77,9 @@ func TestSnapshotExistsMatch(t *testing.T) {

func TestSnapshotExistsDiff(t *testing.T) {
withIsolatedWorkingDir(t)
// Ensure that UPDATE_TOOLSNAPS is not set for this test, which it might be if someone is running
// UPDATE_TOOLSNAPS=true go test ./...
t.Setenv("UPDATE_TOOLSNAPS", "false")

// Given a non-matching snapshot file exists
require.NoError(t, os.MkdirAll("__toolsnaps__", 0700))
Expand Down Expand Up @@ -109,6 +115,9 @@ func TestUpdateToolsnaps(t *testing.T) {

func TestMalformedSnapshotJSON(t *testing.T) {
withIsolatedWorkingDir(t)
// Ensure that UPDATE_TOOLSNAPS is not set for this test, which it might be if someone is running
// UPDATE_TOOLSNAPS=true go test ./...
t.Setenv("UPDATE_TOOLSNAPS", "false")

// Given a malformed snapshot file exists
require.NoError(t, os.MkdirAll("__toolsnaps__", 0700))
Expand Down
35 changes: 35 additions & 0 deletions pkg/github/__toolsnaps__/add_issue_comment.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"annotations": {
"title": "Add comment to issue",
"readOnlyHint": false
},
"description": "Add a comment to a specific issue in a GitHub repository.",
"inputSchema": {
"properties": {
"body": {
"description": "Comment content",
"type": "string"
},
"issue_number": {
"description": "Issue number to comment on",
"type": "number"
},
"owner": {
"description": "Repository owner",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
}
},
"required": [
"owner",
"repo",
"issue_number",
"body"
],
"type": "object"
},
"name": "add_issue_comment"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"annotations": {
"title": "Add comment to the requester's latest pending pull request review",
"readOnlyHint": false
},
"description": "Add a comment to the requester's latest pending pull request review, a pending review needs to already exist to call this (check with the user if not sure).",
"inputSchema": {
"properties": {
"body": {
"description": "The text of the review comment",
"type": "string"
},
"line": {
"description": "The line of the blob in the pull request diff that the comment applies to. For multi-line comments, the last line of the range",
"type": "number"
},
"owner": {
"description": "Repository owner",
"type": "string"
},
"path": {
"description": "The relative path to the file that necessitates a comment",
"type": "string"
},
"pullNumber": {
"description": "Pull request number",
"type": "number"
},
"repo": {
"description": "Repository name",
"type": "string"
},
"side": {
"description": "The side of the diff to comment on. LEFT indicates the previous state, RIGHT indicates the new state",
"enum": [
"LEFT",
"RIGHT"
],
"type": "string"
},
"startLine": {
"description": "For multi-line comments, the first line of the range that the comment applies to",
"type": "number"
},
"startSide": {
"description": "For multi-line comments, the starting side of the diff that the comment applies to. LEFT indicates the previous state, RIGHT indicates the new state",
"enum": [
"LEFT",
"RIGHT"
],
"type": "string"
},
"subjectType": {
"description": "The level at which the comment is targeted",
"enum": [
"FILE",
"LINE"
],
"type": "string"
}
},
"required": [
"owner",
"repo",
"pullNumber",
"path",
"body",
"subjectType"
],
"type": "object"
},
"name": "add_pull_request_review_comment_to_pending_review"
}
31 changes: 31 additions & 0 deletions pkg/github/__toolsnaps__/assign_copilot_to_issue.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"annotations": {
"title": "Assign Copilot to issue",
"readOnlyHint": false,
"idempotentHint": true
},
"description": "Assign Copilot to a specific issue in a GitHub repository.\n\nThis tool can help with the following outcomes:\n- a Pull Request created with source code changes to resolve the issue\n\n\nMore information can be found at:\n- https://docs.github.com/en/copilot/using-github-copilot/using-copilot-coding-agent-to-work-on-tasks/about-assigning-tasks-to-copilot\n",
"inputSchema": {
"properties": {
"issueNumber": {
"description": "Issue number",
"type": "number"
},
"owner": {
"description": "Repository owner",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
}
},
"required": [
"owner",
"repo",
"issueNumber"
],
"type": "object"
},
"name": "assign_copilot_to_issue"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"annotations": {
"title": "Create and submit a pull request review without comments",
"readOnlyHint": false
},
"description": "Create and submit a review for a pull request without review comments.",
"inputSchema": {
"properties": {
"body": {
"description": "Review comment text",
"type": "string"
},
"commitID": {
"description": "SHA of commit to review",
"type": "string"
},
"event": {
"description": "Review action to perform",
"enum": [
"APPROVE",
"REQUEST_CHANGES",
"COMMENT"
],
"type": "string"
},
"owner": {
"description": "Repository owner",
"type": "string"
},
"pullNumber": {
"description": "Pull request number",
"type": "number"
},
"repo": {
"description": "Repository name",
"type": "string"
}
},
"required": [
"owner",
"repo",
"pullNumber",
"body",
"event"
],
"type": "object"
},
"name": "create_and_submit_pull_request_review"
}
34 changes: 34 additions & 0 deletions pkg/github/__toolsnaps__/create_branch.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"annotations": {
"title": "Create branch",
"readOnlyHint": false
},
"description": "Create a new branch in a GitHub repository",
"inputSchema": {
"properties": {
"branch": {
"description": "Name for new branch",
"type": "string"
},
"from_branch": {
"description": "Source branch (defaults to repo default)",
"type": "string"
},
"owner": {
"description": "Repository owner",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
}
},
"required": [
"owner",
"repo",
"branch"
],
"type": "object"
},
"name": "create_branch"
}
52 changes: 52 additions & 0 deletions pkg/github/__toolsnaps__/create_issue.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"annotations": {
"title": "Open new issue",
"readOnlyHint": false
},
"description": "Create a new issue in a GitHub repository.",
"inputSchema": {
"properties": {
"assignees": {
"description": "Usernames to assign to this issue",
"items": {
"type": "string"
},
"type": "array"
},
"body": {
"description": "Issue body content",
"type": "string"
},
"labels": {
"description": "Labels to apply to this issue",
"items": {
"type": "string"
},
"type": "array"
},
"milestone": {
"description": "Milestone number",
"type": "number"
},
"owner": {
"description": "Repository owner",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
},
"title": {
"description": "Issue title",
"type": "string"
}
},
"required": [
"owner",
"repo",
"title"
],
"type": "object"
},
"name": "create_issue"
}
49 changes: 49 additions & 0 deletions pkg/github/__toolsnaps__/create_or_update_file.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"annotations": {
"title": "Create or update file",
"readOnlyHint": false
},
"description": "Create or update a single file in a GitHub repository. If updating, you must provide the SHA of the file you want to update.",
"inputSchema": {
"properties": {
"branch": {
"description": "Branch to create/update the file in",
"type": "string"
},
"content": {
"description": "Content of the file",
"type": "string"
},
"message": {
"description": "Commit message",
"type": "string"
},
"owner": {
"description": "Repository owner (username or organization)",
"type": "string"
},
"path": {
"description": "Path where to create/update the file",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
},
"sha": {
"description": "SHA of file being replaced (for updates)",
"type": "string"
}
},
"required": [
"owner",
"repo",
"path",
"content",
"message",
"branch"
],
"type": "object"
},
"name": "create_or_update_file"
}
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy