Fix for confusing error, closes #1238

This commit is contained in:
Simon Willison 2025-08-11 16:52:16 -07:00
parent 9f1417f6e8
commit e6ac18fbcb
2 changed files with 4 additions and 22 deletions

View file

@ -4019,26 +4019,11 @@ def _gather_tools(
tool for tool in tool_specs if tool.split("(")[0] not in registered_tools
]
if bad_tools:
# Are any of them toolbox tools?
bad_tool_classes = list(
set(
bad_tool.split("_")[0]
for bad_tool in bad_tools
if bad_tool[0].isupper()
raise click.ClickException(
"Tool(s) {} not found. Available tools: {}".format(
", ".join(bad_tools), ", ".join(registered_tools.keys())
)
)
if bad_tool_classes:
raise click.ClickException(
"Toolbox tools ({}) are not yet supported with llm -c".format(
", ".join(bad_tool_classes)
)
)
else:
raise click.ClickException(
"Tool(s) {} not found. Available tools: {}".format(
", ".join(bad_tools), ", ".join(registered_tools.keys())
)
)
for tool_spec in tool_specs:
if not tool_spec[0].isupper():
# It's a function

View file

@ -779,10 +779,7 @@ def test_register_toolbox(tmpdir, logs_db):
["-c", "list them again"],
)
assert result5.exit_code == 1
assert (
result5.output
== "Error: Toolbox tools (Filesystem) are not yet supported with llm -c\n"
)
assert "Error: Tool(s) Filesystem_list_files not found. Available tools:" in result5.output
# Test the logging worked
rows = list(logs_db.query(TOOL_RESULTS_SQL))