Repository navigation
feat: Add tools for interacting with the GitHub API - #109
Conversation
This commit introduces 8 new GitHub tools that leverage the gh package for GitHub API interactions: Read operations: - btw_tool_github_issue_get: Read issue description - btw_tool_github_issue_thread: Read issue with all comments - btw_tool_github_pull_request_get: Read PR description - btw_tool_github_pull_request_diff: Read PR file changes - btw_tool_github_issues_list: List issues with filtering - btw_tool_github_pull_requests_list: List PRs with filtering Write operations: - btw_tool_github_issue_create: Create a new issue - btw_tool_github_pull_request_create: Create a new PR Key features: - Auto-detects owner/repo from git remote using gh::gh_tree_remote() - Conditional registration (only when gh package is installed) - Comprehensive test suite with snapshots using posit-dev/btw #1 - Optional filtering by state, labels, author, and assignee Generated with Claude Code
simonpcouch
left a comment
There was a problem hiding this comment.
Just gave a go at this by configuring the gh tool with Claude Code:
claude mcp add -s "user" r-btw -- Rscript -e "btw::btw_mcp_server(btw::btw_tools('docs', 'github'))"
For now, I'm seeing issues with calling the tool via MCP:
⏺ r-btw - btw_tool_github (MCP)(code: "gh(\"/repos/posit-dev/mcptools/issues\",
state = \"open\")", _intent: "Fetch open issues
for posit-dev/mcptools")
⎿ Error: MCP error -32603: could not find function "btw_gh_fields"
Ooh, I bet I need to do some more work to get the limited R env to find btw tools. My guess is that it's working for me when I use |
|
@simonpcouch can you point me to where mcptools does the tool calling bit? I can't repro without involving mcptools |
|
@simonpcouch I pushed a few changes this morning that may or may not be related, but I was able to use this tool through Claude Code with |
|
Installed the new version and am using successfully via MCP! Thanks for putting time in there. Seems like both Claude 4.5 Sonnet and GPT-5 are having no trouble using the tool successfully. Super stoked about this feature. :) |
Closes #108
This PR adds a new
btw_tool_github()tool to the btw collection.I initially implemented this as several tools, but decided to go in a new direction.
Instead, I settled on a single tool that wraps
gh::gh()and lets the LLM just write code to interact with the GitHub API. We do not let the model just "write code", instead, it's allowed to write calls togh()andgh_whoami(). There are a very limited number of functions available to the LLM for use, where basically almost anything other than a bare call togh()will fail.Additionally, there's an endpoint filtering mechanism in place that includes a large built-in allow and block lists to limit the LLM to using specific endpoints. There's also an options mechanism where users can add additional allow and block rules, either via R options or in the
btw.mdYAML file.