Compare commits

...

2 Commits

Author SHA1 Message Date
Iris
ae0b25ca23 style: ruff format generate_tool_specs.py 2026-04-08 15:14:41 +00:00
Iris
8c42918dcf fix: exclude tool_type from tool.specs.json init params
The @computed_field tool_type on BaseTool (added for checkpoint
deserialization) was leaking into the generated tool.specs.json via
model_json_schema(mode='serialization'). Studio reads this file and
was rendering 'Tool Type' as a required field users couldn't fill in.

Changes:
- Add 'tool_type' to ignored_init_params in generate_tool_specs.py
- Also filter ignored params from the 'required' list in the schema
- Add TDD test asserting tool_type is excluded from init_params_schema
- Regenerate tool.specs.json (tool_type removed from all tools)
2026-04-08 15:06:10 +00:00
3 changed files with 111 additions and 694 deletions

View File

@@ -167,6 +167,7 @@ class ToolSpecExtractor:
"max_usage_count",
"current_usage_count",
"package_dependencies",
"tool_type",
]
json_schema = tool_class.model_json_schema(
@@ -178,6 +179,10 @@ class ToolSpecExtractor:
for key, value in json_schema["properties"].items()
if key not in ignored_init_params
}
if "required" in json_schema:
json_schema["required"] = [
key for key in json_schema["required"] if key not in ignored_init_params
]
return json_schema
def save_to_json(self, output_path: str) -> None:

View File

@@ -169,6 +169,19 @@ def test_extract_package_dependencies(mock_tool_extractor):
]
def test_tool_type_excluded_from_init_params(mock_tool_extractor):
"""tool_type is an internal computed_field for checkpoint deserialization.
It must NOT leak into the init_params_schema that Studio reads, otherwise
users see a required 'Tool Type' field they can't fill in."""
init_schema = mock_tool_extractor["init_params_schema"]
assert "tool_type" not in init_schema.get("properties", {}), (
"tool_type should not appear in init_params_schema properties"
)
assert "tool_type" not in init_schema.get("required", []), (
"tool_type should not appear in init_params_schema required list"
)
def test_save_to_json(extractor, tmp_path):
extractor.tools_spec = [
{

File diff suppressed because it is too large Load Diff