feat(scripted-tool): add --help flag to tool callbacks#1288
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--helpflag inToolBuiltinAdapterbefore calling the callbackhelp <tool>)--helpis presentDetails
When a tool callback receives
--helpas 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 meanscreate_agent --helpworks the same ashelp create_agent.The
--helpflag takes precedence — evenget_user --help --id 42returns help without invoking the callback.Test plan
test_tool_help_flag_returns_help_text— verifies help text contenttest_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 tohelp <tool>test_tool_help_flag_stripped_from_args— verifies --help takes precedence over other flagsCloses #1278