Skip to content

Feature/v2 client filters#2212

Closed
masroorhussainv wants to merge 11 commits intogithub:mainfrom
masroorhussainv:feature/v2-client-filters
Closed

Feature/v2 client filters#2212
masroorhussainv wants to merge 11 commits intogithub:mainfrom
masroorhussainv:feature/v2-client-filters

Conversation

@masroorhussainv
Copy link

Summary

Adds optional client-side filters to issue_read and pull_request_read so AI agents can retrieve only the comments/reviews they need, reducing token usage.

Why

Fixes #

Without filtering, fetching comments or reviews on a large PR returns the full unfiltered list. Agents must scan through all items, burning tokens on irrelevant content.

What changed

  • Added CommentFilters, ReviewCommentFilters, ReviewFilters types in pkg/github/filters.go with apply functions and helpers
  • Added author, bodyContains, createdAfter, createdBefore params to issue_read (applies to get_comments)
  • Added author, bodyContains, createdAfter, createdBefore, filePath, reviewer, state, submittedAfter, submittedBefore params to pull_request_read
  • 28 unit tests in filters_test.go covering all filter types and edge cases

MCP impact

  • Tool schema or behavior changed — new optional params on issue_read and pull_request_read; no existing behavior is altered when params are omitted

Prompts tested (tool changes only)

Security / limits

  • Data exposure, filtering, or token/size limits considered — filters reduce response size; all filtering is client-side post-fetch so no new API calls are made

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

  • Tested locally with ./script/test

Docs

  • Not needed

masroorhussainv and others added 11 commits March 14, 2026 14:03
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds --skip-ssl-verify flag (GITHUB_SKIP_SSL_VERIFY env var) that disables
TLS certificate verification for both REST and GraphQL clients. Intended for
private GitHub Enterprise instances with self-signed or missing certificates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers: default transport passthrough, InsecureSkipVerify flag set,
successful connection to self-signed TLS server, and TLS rejection
when skip is disabled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds ParseGitHubURL and ApplyURLParam to pkg/github/url_parse.go.

ParseGitHubURL parses any GitHub resource URL (repo, issue, PR, file blob)
across github.com and self-hosted GHE instances, extracting owner, repo,
number, ref, and path.

ApplyURLParam applies parsed URL fields into a tool's args map before
parameter extraction, with explicitly set params taking precedence.
29 tests covering valid URLs, error cases, and precedence rules.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a new get_repository tool that fetches metadata for a single GitHub
repository by owner/repo or by URL. Returns a richer field set than
MinimalRepository: visibility, clone_url, ssh_url, is_template, pushed_at,
and named is_fork/is_archived fields.

Integrates with ApplyURLParam so agents can pass a full repo URL instead
of discrete owner/repo params. 8 tests covering happy path, URL parsing,
precedence, missing params, and API errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds optional client-side filtering to IssueRead and PullRequestRead
to reduce token usage when AI agents only need a subset of comments.

New filter params on issue_read (applies to get_comments):
  - author: filter by comment author login (case-insensitive)
  - bodyContains: filter by substring or regex in comment body

New filter params on pull_request_read:
  - author: filter by author login (get_comments + get_review_comments)
  - bodyContains: filter by body text (get_comments + get_review_comments)
  - filePath: glob pattern for review thread file path (get_review_comments)
  - reviewer: filter by reviewer login (get_reviews)
  - state: filter by review state (get_reviews)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds createdAfter/createdBefore params to comment and review comment
filters, and submittedAfter/submittedBefore to review filters. All
dates are RFC3339 strings; invalid or unparseable dates are excluded.

- issue_read: createdAfter, createdBefore (get_comments)
- pull_request_read: createdAfter, createdBefore (get_comments, get_review_comments)
- pull_request_read: submittedAfter, submittedBefore (get_reviews)

12 new tests added covering after, before, combined, and invalid date edge cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@masroorhussainv masroorhussainv requested a review from a team as a code owner March 14, 2026 12:21
@masroorhussainv masroorhussainv deleted the feature/v2-client-filters branch March 14, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant