fix: Add experimental feature to use parameters_json_schema and response_json_schema for McpTool

Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 833144947
This commit is contained in:
Xuan Yang
2025-11-16 20:55:16 -08:00
committed by Copybara-Service
parent f7f6837fde
commit 1dd97f5b45
10 changed files with 581 additions and 36 deletions
+6
View File
@@ -364,9 +364,15 @@ def _build_function_declaration_log(
k: v.model_dump(exclude_none=True)
for k, v in func_decl.parameters.properties.items()
})
elif func_decl.parameters_json_schema:
param_str = str(func_decl.parameters_json_schema)
return_str = ''
if func_decl.response:
return_str = '-> ' + str(func_decl.response.model_dump(exclude_none=True))
elif func_decl.response_json_schema:
return_str = '-> ' + str(func_decl.response_json_schema)
return f'{func_decl.name}: {param_str} {return_str}'