Skip to content

fix(tools): list supported methods in unknown-method dispatch errors#2769

Open
syf2211 wants to merge 1 commit into
github:mainfrom
syf2211:fix/2712-unknown-method-errors
Open

fix(tools): list supported methods in unknown-method dispatch errors#2769
syf2211 wants to merge 1 commit into
github:mainfrom
syf2211:fix/2712-unknown-method-errors

Conversation

@syf2211

@syf2211 syf2211 commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Improve consolidated method-dispatch MCP tools to return actionable errors when an unrecognized method is provided, matching the existing label_write behavior.

Motivation

Fixes #2712. Tools such as pull_request_read, pull_request_review_write, issue_read, sub_issue_write, actions_*, projects_*, and ui_get previously returned bare unknown method: <value> errors. When method was omitted from pull_request_review_write, callers saw unknown method: with an empty value instead of a required-parameter error.

Changes

  • Add shared methodEnum() and unknownMethodError() helpers in pkg/github/params.go
  • Declare per-tool method slices as the single source for schema enums and runtime validation
  • Update consolidated tools to use the helpers in their default branches
  • Validate required method in pull_request_review_write before WeakDecode routing
  • Add regression tests for helpers and pull_request_review_write error paths
  • Update sub_issue_write toolsnap enum

Tests

go test ./pkg/github/... -count=1

Result: PASS (0.161s)

Notes

  • Rebased on current main; issue_read retains get_parent support.
  • label_write already had inline supported-method messaging and was left unchanged to keep scope minimal.
  • Related open PR Improve "unknown method" errors to list supported methods #2713 appears conflicted/stale; this branch is a fresh implementation on current main.

- Add methodEnum/unknownMethodError helpers in params.go
- Use shared method slices for schema enums and runtime validation
- Update actions, issues, pull_requests, projects, and ui_get tools
- Require method param in pull_request_review_write before WeakDecode
- Add regression tests for helper and pull_request_review_write errors

Fixes github#2712
@syf2211 syf2211 requested a review from a team as a code owner June 25, 2026 10:25
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.

Consolidated method-dispatch tools return unhelpful "unknown method" errors (don't list supported methods)

3 participants