File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 2929from google .genai import types
3030import pydantic
3131
32+ from ..tools .tool_context import ToolContext
3233from ..utils .variant_utils import GoogleLLMVariant
3334
3435_py_builtin_type_to_schema_type = {
@@ -315,6 +316,13 @@ def _parse_schema_from_parameter(
315316 )
316317 _raise_if_schema_unsupported (variant , schema )
317318 return schema
319+ if inspect .isclass (param .annotation ) and issubclass (
320+ param .annotation , ToolContext
321+ ):
322+ raise ValueError (
323+ '`ToolContext` parameter must be named as `tool_context`. Found'
324+ f' `{ param .name } ` instead in function `{ func_name } `.'
325+ )
318326 if param .annotation is None :
319327 # https://swagger.io/docs/specification/v3_0/data-models/data-types/#null
320328 # null is not a valid type in schema, use object instead.
You can’t perform that action at this time.
0 commit comments