Skip to content

feat(search): add typed projected result outputs - #3386

Open
SamMorrowDrums wants to merge 2 commits into
sammorrowdrums-typed-comment-visibility-toolsfrom
sammorrowdrums-typed-search-projected-outputs
Open

SamMorrowDrums wants to merge 2 commits into
sammorrowdrums-typed-comment-visibility-toolsfrom
sammorrowdrums-typed-search-projected-outputs

Conversation

@SamMorrowDrums

@SamMorrowDrums SamMorrowDrums commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds typed inputs, compact output schemas, and protocol-gated structured results for seven search and repository-list read tools while preserving their legacy text output.

Why

This is the next migration layer in the typed-schema stack, making modern clients able to consume validated structured outputs without changing older-client behavior.
Fixes N/A — this stack layer has no linked issue.

What changed

  • Migrated search_code, search_issues, search_pull_requests, list_issues, list_pull_requests, list_branches, and list_tags to the typed registration path.
  • Added compact typed output DTOs that honor requested fields projections; retained existing text serializers, scope policies, error handling, and IFC labels.
  • Added input normalization for legacy enum casing and numeric-string pagination, and removed the obsolete raw field_filters parser.
  • Added protocol wire, output-schema conformance, projection, and compatibility tests. Tool input schemas were unchanged, so existing toolsnap snapshots remain valid; script/generate-docs produced no documentation diff.

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
    Modern protocol clients receive output schemas and structured content for the seven migrated tools. Legacy/unknown clients retain their existing text output and behavior.
  • New tool added

Prompts tested (tool changes only)

  • “Search GitHub code for main.go and return only the name field.” — exercised search_code with fields: ["name"] and verified text/structured output match.
  • “List tags in owner/repo.” — exercised list_tags and verified legacy text and modern structured output.
  • Output schemas for all seven tools were resolved and validated against representative output values in TestTypedProjectedReadToolOutputSchemas.

Security / limits

  • No security or limits impact
  • Auth / permissions considered
    Existing scope access declarations were preserved.
  • Data exposure, filtering, or token/size limits considered
    Structured DTOs remain compact and respect each tool’s existing fields selection; IFC labeling and sanitization paths are preserved.

Tool renaming

  • I am renaming tools as part of this PR (e.g. as a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

./script/lint ran but reports three govet diagnostics on unchanged parent-stack code: pkg/github/discussions.go:102:24, pkg/github/discussions.go:103:24, and pkg/lockdown/lockdown_test.go:92:70, each inline: cannot inline: type parameter inference is not yet supported. Compatible checks passed with ./bin/golangci-lint run --disable govet (0 issues). ./script/test passed. Focused tests passed with go test ./pkg/github -run '^(TestTypedProjectedReadTool(OutputSchemas|OutputsRespectFieldSelection)|TestNormalizeTypedReadArgumentsPreservesLegacyValues|Test_SearchCode|Test_SearchIssues|Test_ListIssues|Test_ListPullRequests|Test_SearchPullRequests|Test_ListBranches|Test_ListTags)$' -count=1. script/generate-docs passed with no generated documentation changes. CI was still pending at the last check; the PR remains draft.

Docs

  • Not needed
  • Updated (README / docs / examples)

script/generate-docs completed successfully; it produced no changes because the input tool documentation did not change.

@SamMorrowDrums
SamMorrowDrums added this pull request to stack #3385 October 2, 2026 10:51
@SamMorrowDrums
SamMorrowDrums force-pushed the sammorrowdrums-typed-search-projected-outputs branch from 41e57ce to 91f660e Compare October 2, 2026 11:02
@SamMorrowDrums
SamMorrowDrums force-pushed the sammorrowdrums-typed-search-projected-outputs branch 2 times, most recently from 7c2185f to 9cc1a97 Compare October 2, 2026 20:50
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ License files need updating

The license files are out of date. I tried to fix them automatically but don't have permission to push to this branch.

Please run:

script/licenses
git add third-party-licenses.*.md third-party/
git commit -m "chore: regenerate license files"
git push

Alternatively, enable "Allow edits by maintainers" in the PR settings so I can fix it automatically.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Structured issue results lose meaningful empty field_values, and most inferred item schemas lack representative validation.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds typed, protocol-gated structured outputs to seven search and repository-list tools while retaining legacy text responses.

Changes:

  • Adds typed inputs, projected output DTOs, and compatibility normalization.
  • Gates output schemas and structured content by protocol version.
  • Adds projection/schema tests and regenerates license reports.
File Description
pkg/​github/​search.go Types search_code input and output.
pkg/​github/​search_utils.go Types shared issue/PR search handling.
pkg/​github/​issues.go Types issue search/list projections.
pkg/​github/​pullrequests.go Types PR search/list projections.
pkg/​github/​repositories.go Types branch and tag outputs.
pkg/​github/​typed_read_normalizers.go Normalizes legacy typed arguments.
pkg/​github/​typed_search_outputs_test.go Tests schemas, protocol gating, and projections.
third-party-licenses.linux.md Consolidates Linux architecture licenses.
third-party-licenses.windows.md Consolidates Windows architecture licenses.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/github/issues.go Outdated
Type *string `json:"type,omitempty"`
RepositoryURL *string `json:"repository_url,omitempty"`
PullRequest *SearchIssuePullRequest `json:"pull_request,omitempty"`
FieldValues []MinimalFieldValue `json:"field_values,omitempty"`
Comment thread pkg/github/typed_search_outputs_test.go Outdated
Comment on lines +111 to +112
case "search_code", "search_issues", "search_pull_requests":
return map[string]any{"total_count": 0, "incomplete_results": false, "items": []any{}}
@SamMorrowDrums
SamMorrowDrums force-pushed the sammorrowdrums-typed-search-projected-outputs branch from 6a58bc1 to eafea77 Compare October 3, 2026 12:31
SamMorrowDrums and others added 2 commits October 3, 2026 15:00
…tures

Address review findings on the typed search/list projected-output
tools (search_code, search_issues, search_pull_requests, list_issues,
list_pull_requests, list_branches, list_tags):

- issues.go/pullrequests.go: change FieldValues to a pointer-to-slice
  (*[]MinimalFieldValue) so a successful-but-empty [] is preserved in
  structuredContent, matching legacy text output instead of being
  dropped by omitempty.
- search.go: related adjustments to keep typed search outputs aligned
  with the field_values presence fix.
- typed_search_outputs_test.go: add representative nested/non-empty
  projected item fixtures so schema-conformance tests actually
  exercise item shapes instead of only validating empty collections.
- Add/update toolsnaps for list_branches, list_issues,
  list_pull_requests, list_tags, search_code, search_issues, and
  search_pull_requests to reflect the schema.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@SamMorrowDrums
SamMorrowDrums force-pushed the sammorrowdrums-typed-search-projected-outputs branch from eafea77 to 1447006 Compare October 3, 2026 13:12
@SamMorrowDrums
SamMorrowDrums marked this pull request as ready for review October 3, 2026 13:41
@SamMorrowDrums
SamMorrowDrums requested a review from a team as a code owner October 3, 2026 13:41
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.

2 participants