Skip to content

feat(scripted-tool): add --help flag to tool callbacks#1288

Merged
chaliy merged 1 commit intomainfrom
feat/1278-scripted-tool-help
Apr 14, 2026
Merged

feat(scripted-tool): add --help flag to tool callbacks#1288
chaliy merged 1 commit intomainfrom
feat/1278-scripted-tool-help

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 14, 2026

Summary

  • Intercept --help flag in ToolBuiltinAdapter before calling the callback
  • Return auto-generated help text from ToolDef schema (same output as help <tool>)
  • Callback is never invoked when --help is present

Details

When a tool callback receives --help as a flag, ScriptedTool now intercepts it before calling the callback and returns auto-generated help text from the ToolDef schema (name, description, parameters with types). This means create_agent --help works the same as help create_agent.

The --help flag takes precedence — even get_user --help --id 42 returns help without invoking the callback.

Test plan

  • test_tool_help_flag_returns_help_text — verifies help text content
  • test_tool_help_flag_does_not_invoke_callback — verifies callback not called (even for fail_tool)
  • test_tool_help_flag_same_as_help_builtin — verifies identical output to help <tool>
  • test_tool_help_flag_stripped_from_args — verifies --help takes precedence over other flags
  • All 98 scripted_tool tests pass

Closes #1278

When a tool callback receives `--help`, ScriptedTool now intercepts it
before calling the callback and returns auto-generated help text from
the ToolDef schema (name, description, parameter flags). This produces
the same output as `help <tool_name>`.

The callback is never invoked when --help is present, even if other
flags are also passed (e.g. `get_user --help --id 42`).

Closes #1278
@chaliy chaliy merged commit 7480cbc into main Apr 14, 2026
27 checks passed
@chaliy chaliy deleted the feat/1278-scripted-tool-help branch April 14, 2026 10:00
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.

feat(scripted-tool): add --help flag to tool callbacks

1 participant