Skip to content

fix: list supported methods in unknown method errors#2910

Open
srpatcha wants to merge 1 commit into
github:mainfrom
srpatcha:fix/unknown-method-list-supported
Open

fix: list supported methods in unknown method errors#2910
srpatcha wants to merge 1 commit into
github:mainfrom
srpatcha:fix/unknown-method-list-supported

Conversation

@srpatcha

Copy link
Copy Markdown

Summary

Fixes #2712

The consolidated method-dispatch tools returned a bare unknown method: <value> without listing valid methods, unlike labels.go which already says Supported methods are: create, update, delete. This makes the behavior inconsistent and unhelpful for callers.

Changes

Appended the list of supported methods to every unknown method error across the method-dispatch tools:

File Tool(s)
issues.go issue_read, sub-issue write
issue_dependencies.go sub-issue read / write
ui_tools.go ui_get
pullrequests.go pull_request_read, pull_request_review_write
projects.go projects list / get / write
actions.go actions list / get / run

Additionally, pull_request_review_write used mapstructure.WeakDecode and did not validate that method was provided, so omitting it produced a confusing unknown method: (empty value) — which reads like a routing bug rather than a missing argument. Added an explicit check:

if params.Method == "" {
    return utils.NewToolResultError("missing required parameter: method. Supported methods are: create, submit_pending, delete_pending, resolve_thread, unresolve_thread"), nil, nil
}

Testing

All existing tests that assert on unknown method use assert.Contains, so the appended text preserves the existing substring matches — no test changes required. The new error messages are strict supersets of the previous ones.

The consolidated method-dispatch tools returned a bare
"unknown method: <value>" without listing valid methods, unlike
labels.go which already says "Supported methods are: ...".

Make the error messages consistent across all method-dispatch tools
by appending the list of supported methods:
- issue_read, sub-issue write (issues.go)
- sub-issue read/write (issue_dependencies.go)
- ui_get (ui_tools.go)
- pull_request_read, pull_request_review_write (pullrequests.go)
- projects list/get/write (projects.go)
- actions list/get/run (actions.go)

Additionally, pull_request_review_write decoded arguments with
mapstructure.WeakDecode and did not validate that method was
provided, so an omitted method produced a confusing "unknown
method: " (empty value). Add an explicit check that reports
"missing required parameter: method" with the supported methods.

Fixes github#2712

Signed-off-by: Srikanth Patchava <srpatcha@users.noreply.github.com>
@srpatcha
srpatcha requested a review from a team as a code owner July 20, 2026 04:07
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