Skip to content

feat(tools): add two new GraphQL tools#242

Merged
saidsef merged 8 commits into
mainfrom
feat/graphql-pr-tools
May 17, 2026
Merged

feat(tools): add two new GraphQL tools#242
saidsef merged 8 commits into
mainfrom
feat/graphql-pr-tools

Conversation

@saidsef
Copy link
Copy Markdown
Owner

@saidsef saidsef commented May 16, 2026

Two new GraphQL tools, plus a handful of improvements made along the way.

New tools

get_pr_linked_issues - returns issues that will auto-close when the PR merges, via closingIssuesReferences on the GraphQL PullRequest type. Parsing "Closes #N" from the body misses issues linked through the GitHub UI and cross-repo references; this is the authoritative source.

get_pr_status_checks - returns check run conclusions and legacy commit status contexts for the PR's HEAD commit, plus an overall field (passing / failing / pending / unknown). get_pr_content only exposes mergeable, which reflects git conflict state, not CI.

Other changes

  • Errors now raise ToolError instead of returning {"status": "error", ...} dicts. MCP clients get a proper error response rather than a success response with an error payload.
  • ToolAnnotations (readOnlyHint, destructiveHint) are now applied via @_read_only / @_destructive decorators directly on the methods in github_integration.py, rather than a separate name-to-annotation lookup table in issues_pr_analyser.py.
  • _derive_overall (cyclomatic complexity 13) split into _has_failing_checks and _has_pending_checks helpers (complexity 5 and 4 respectively).
  • Removed IPInfoError exception class along with the IP tools removed in a prior commit.
  • Fixed duplicate ### Features heading in README.

Testing

uv run ruff check . && uv run ruff format .
uv run pyright src/mcp_github/
uv run pytest

saidsef added 2 commits May 13, 2026 18:10
Batch update 5 dependencies from open dependabot PRs (#234-#237, #239):

- authlib 1.7.0 -> 1.7.1 (PR #239)
- cryptography 47.0.0 -> 48.0.0 (PR #234)
- jsonschema-path 0.4.5 -> 0.4.6 (PR #237)
- pydantic-settings 2.14.0 -> 2.14.1 (PR #235)
- uv 0.11.12 -> 0.11.13 (PR #236)

Note: pydantic-core (PR #238) excluded - bumping it independently
conflicts with pydantic==2.13.3 which pins pydantic-core==2.46.3 exactly.
Two new GraphQL-backed tools that close genuine agent blind spots:

- get_pr_linked_issues: queries closingIssuesReferences to return the
  authoritative list of issues that auto-close on merge. More reliable
  than text-parsing "Closes #N" keywords from the PR body, and picks up
  issues linked via the GitHub UI.

- get_pr_status_checks: queries check suites and legacy commit status
  from the PR HEAD commit. Derives an overall "passing/failing/pending/
  unknown" state so agents can make a merge decision without asking the
  user whether CI is green.

Both auto-register as MCP tools via the existing inspect.getmembers()
mechanism. Also fix pre-existing ruff formatting issues in auth.py,
tests/__init__.py, and tests/test_auth.py.
@saidsef saidsef added enhancement New feature or request python Pull requests that update python code github-integration MCP-tool labels May 16, 2026
@saidsef saidsef self-assigned this May 16, 2026
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 16, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 43 complexity

Metric Results
Complexity 43

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2026

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 4 package(s) with unknown licenses.
See the Details below.

License Issues

requirements.txt

PackageVersionLicenseIssue Type
authlib1.7.1NullUnknown License
jsonschema-path0.4.6NullUnknown License
pydantic-settings2.14.1NullUnknown License
uv0.11.13NullUnknown License

OpenSSF Scorecard

PackageVersionScoreDetails
pip/authlib 1.7.1 UnknownUnknown
pip/cryptography 48.0.0 UnknownUnknown
pip/jsonschema-path 0.4.6 UnknownUnknown
pip/pydantic-settings 2.14.1 UnknownUnknown
pip/uv 0.11.13 UnknownUnknown

Scanned Files

  • requirements.txt

github-actions[bot]
github-actions Bot previously approved these changes May 16, 2026
…ove IP tools

- Replace all return {"status": "error"} patterns with raise ToolError so
  agents see failures as errors rather than successful results with error
  payloads; merge_pr preserves the GitHub API message before raising
- Add ToolAnnotations to the registration layer: readOnlyHint=True on all
  read-only tools so Claude skips confirmation prompts; destructiveHint=True
  on merge_pr
- Remove get_ipv4_info and get_ipv6_info (IPIntegration, ip_integration.py,
  ip-lookup skill, IPInfoError) - no genuine value in a GitHub-focused MCP
- Remove traceback import from github_integration (now unused)
github-actions[bot]
github-actions Bot previously approved these changes May 16, 2026
…tors

Replace the centralised _TOOL_ANNOTATIONS lookup dict in issues_pr_analyser.py
with _read_only/_destructive decorator helpers in github_integration.py that
stamp a _mcp_annotations attribute directly on each method.
github-actions[bot]
github-actions Bot previously approved these changes May 16, 2026
Rename duplicate '### Features' heading in README to '### Tool Categories'.
Extract status-set literals in _derive_overall to module-level frozensets and
replace comprehension conditionals with set-difference, reducing cyclomatic
complexity from 13 to 7.
github-actions[bot]
github-actions Bot previously approved these changes May 16, 2026
Replace module-level frozenset constants with _has_failing_checks and
_has_pending_checks private methods, restoring inline local sets and
reducing _derive_overall cyclomatic complexity from 10 to 6.
@saidsef saidsef changed the title feat(tools): add get_pr_linked_issues and get_pr_status_checks feat(tools): add two new GraphQL tools May 16, 2026
github-actions[bot]
github-actions Bot previously approved these changes May 16, 2026
Eleven public methods were registered without ToolAnnotations, leaving
MCP clients unable to classify them as read/write. Adds a _write()
decorator (readOnlyHint=False) and applies it to add_pr_comments,
add_inline_pr_comment, update_pr_description, create_pr, create_issue,
update_pr_branch, update_issue, update_reviews, update_assignees,
create_tag, and create_release.
github-actions[bot]
github-actions Bot previously approved these changes May 16, 2026
@saidsef saidsef merged commit 2fc8a6d into main May 17, 2026
6 checks passed
@saidsef saidsef deleted the feat/graphql-pr-tools branch May 17, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request github-integration MCP-tool python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant