Skip to content

Improve "unknown method" errors to list supported methods#2713

Open
gustavo-sec wants to merge 2 commits into
github:mainfrom
gustavo-sec:improve-unknown-method-errors
Open

Improve "unknown method" errors to list supported methods#2713
gustavo-sec wants to merge 2 commits into
github:mainfrom
gustavo-sec:improve-unknown-method-errors

Conversation

@gustavo-sec

Copy link
Copy Markdown

Closes #2712.

The consolidated method-dispatch tools returned a bare unknown method: <x> with no hint of valid values, and each tool's valid method set lived only in its schema enum (or, for sub_issue_write, only in prose). labels.go already listed the supported methods on an unknown value; this brings the rest in line and makes the advertised methods the single source of truth.

What changed

  • Each tool's method set is a single []string that feeds both the input-schema enum (methodEnum) and the unknown-method error (unknownMethodError), so the advertised methods and the accepted methods cannot drift apart.
  • An unknown method now lists the supported set: unknown method: x. Supported methods are: ....
  • pull_request_review_write decoded args with mapstructure.WeakDecode (it does not use RequiredParam like the other tools), so an omitted method surfaced as unknown method: (empty value). It now reports missing required parameter: method, consistent with every other tool.
  • sub_issue_write advertised its method options only in the description; it now declares the enum like every other method-dispatch tool.

Affected tools: pull_request_read, pull_request_review_write, issue_read, sub_issue_write, actions (list/get/run), projects (list/get/write), ui_get.

Testing

  • go test ./... — green.
  • golangci-lint run (v2.9.0) — 0 issues.
  • script/generate-docs — no changes.
  • Tool snapshots regenerated: only sub_issue_write changed (it gained the advertised method enum).
  • Added unit tests for the helpers and for the review-write empty/unknown-method paths; tightened the existing projects/ui_get unknown-method assertions.
  • Verified live over stdio against a running server: omitted method → missing required parameter: method; method: "bogus"unknown method: bogus. Supported methods are: ....

The consolidated method-dispatch tools returned a bare "unknown method: <x>"
with no hint of valid values, and each tool's valid method set lived only in
its schema enum (or, for sub_issue_write, only in prose). labels.go already
listed the supported methods on an unknown value; this brings the rest in line
and makes the advertised methods the single source of truth.

- Each tool's method set is a single []string that feeds both the input-schema
  enum (methodEnum) and the unknown-method error (unknownMethodError), so the
  advertised methods and the accepted methods cannot drift apart.
- An unknown method now lists the supported set:
  "unknown method: x. Supported methods are: ...".
- pull_request_review_write decoded args with WeakDecode (no RequiredParam), so
  an omitted method surfaced as "unknown method: " (empty). It now reports
  "missing required parameter: method", consistent with the other tools.
- sub_issue_write advertised its method options only in the description; it now
  declares the enum like every other method-dispatch tool.

Closes github#2712
@gustavo-sec gustavo-sec requested a review from a team as a code owner June 17, 2026 02:43
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)

2 participants