What ADK reads off your function
Hand that function to ADK and it writes a description of it. That description is the only thing a model ever sees, so it is worth looking at once.
from google.adk.tools import FunctionTool
def lookup_order(order_id: str) -> str:
"""Look up the status of an order by its id."""
return f"Order {order_id} shipped on 3 March."
declaration = FunctionTool(func=lookup_order)._get_declaration()
print("name: ", declaration.name)
print("description:", declaration.description)Your function name became the name. Your docstring became the description. Nothing was invented, and nothing else was added.
And the arguments
schema = declaration.parameters_json_schema
print("parameters:", list(schema["properties"]))
print("types: ", {k: v["type"] for k, v in schema["properties"].items()})
print("required: ", schema["required"])The type hint became the type. The parameter is required because it has no default value, and giving it one would make it optional.
Running this also prints a warning saying the JSON schema feature is experimental. It is ADK saying the shape of that one field may change, and it does not affect anything you are about to build.
The whole point
A model never sees your code. It sees this: a name, a sentence, and a list of arguments. When an agent calls the wrong tool, this is the thing to print first, because it is exactly what the model was working from.
- Change the docstring and print the declaration again.
- Add a second parameter with a default value and see it leave the required list.
Slow is fine. Stopping is the only problem.