M8.0: Add tool-level input_schema and output_schema contracts to Tool
This commit is contained in:
parent
23ac54f5c8
commit
0323a39afb
|
|
@ -431,6 +431,8 @@ class Tool:
|
|||
source: Optional[ToolSource] = None # Attribution for imported/external tools
|
||||
version: str = "" # Tool version
|
||||
visibility: str = "public" # "public", "private", or "unlisted"
|
||||
input_schema: Optional[dict] = None # JSON Schema for tool input contract
|
||||
output_schema: Optional[dict] = None # JSON Schema for tool output contract
|
||||
path: Optional[Path] = None # Path to config.yaml (set by load_tool)
|
||||
|
||||
@classmethod
|
||||
|
|
@ -483,6 +485,8 @@ class Tool:
|
|||
source=source,
|
||||
version=data.get("version", ""),
|
||||
visibility=data.get("visibility", "public"),
|
||||
input_schema=data.get("input_schema"),
|
||||
output_schema=data.get("output_schema"),
|
||||
)
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
|
|
@ -498,6 +502,10 @@ class Tool:
|
|||
# Only include visibility if it's not the default
|
||||
if self.visibility and self.visibility != "public":
|
||||
d["visibility"] = self.visibility
|
||||
if self.input_schema:
|
||||
d["input_schema"] = self.input_schema
|
||||
if self.output_schema:
|
||||
d["output_schema"] = self.output_schema
|
||||
# Include source attribution if present
|
||||
if self.source:
|
||||
d["source"] = self.source.to_dict()
|
||||
|
|
|
|||
Loading…
Reference in New Issue