adk-tool-interface-design
Skill9 starsChanged 17 days agoMITView on GitHub
Design, diagnose or review the model-facing interface of Python Google ADK tools and tool-like sub-agents, including FunctionTool docstrings and parameter schemas, naming and namespacing, consolidation versus splitting, tool-count budgets and dynamic toolsets, result shaping and size, actionable error returns, and the choice between AgentTool, sub_agents and single_turn mode. Use when the model picks the wrong tool or arguments, tool results bloat context, or a new tool or toolset needs a schema. Do not activate for retries, deadlines or idempotency of the external call (safe-api-tool-calls), credentials and identity (adk-tool-auth-and-secrets), budgets and approval policy (adk-operational-guardrails), measurement over a case set (adk-agent-evaluation), agent instruction text (adk-agent-instructions) or output schemas (adk-model-and-output-contracts).
In this repository25 other files it gives its agents.
- adk-agent-evaluationSkill
- adk-agent-instructionsSkill
- adk-agent-interoperabilitySkill
- adk-agent-observabilitySkill
- adk-agent-securitySkill
- adk-discoverySkill
- adk-engineerSkill
- adk-fastapi-backendSkill
- adk-frontend-integrationSkill
- adk-governance-packSkill
- adk-memory-architectureSkill
- adk-model-and-output-contractsSkill
- adk-operational-guardrailsSkill
- adk-portability-planningSkill
- adk-presenterSkill
- adk-release-engineeringSkill
- adk-sql-agent-engineeringSkill
- adk-system-designerSkill
- adk-tool-auth-and-secretsSkill
- adk-workflow-designSkill
- deploy-adk-on-google-cloudSkill
- optimise-adk-on-google-cloudSkill
- practice-profileSkill
- protect-adk-sensitive-dataSkill
- safe-api-tool-callsSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 3 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Read the tool functions, toolsets, agent definitions (tools=, sub_agents=, mode=, description=), the instruction text that mentions tools, …
- Distinctive: line 35
Run the read-only linter from this skill's directory with an available Python 3.11+ interpreter (interpreters):
- Very specific: line 49
If recorded events exist (an adk web session export or test capture), measure result cost:
- Distinctive: line 59
Ask only for decisions the source cannot settle: which tools must stay separate for policy reasons, what result size the application …
- Very specific: line 75
When the project has agents-cli-manifest.yaml, consult the installed google-agents-cli-adk-code skill (references/adk-python.md, "Tools", …
- Very specific: line 86
Write the docstring as the whole interface: what it does and returns, when to use it and when not (name the alternative), one line per …
- Very specific: line 93
Prefer few parameters of primitive type (str, int, float, bool, list[str], dict[str, Any], Optional[T], an Enum).
- Very specific: line 98
Never ask the model for identity, tenant, secrets or the current date.
- Very specific: line 104
Use async def for I/O tools so ADK can run independent calls concurrently, and make tools that may be selected together side-effect-safe in …
- Very specific: line 107
Place guardrails where they belong: argument validation that returns an error dict in before_tool_callback (return None, not {}, to let the …
- Very specific: line 118
Do not edit generate_content_config.tools.
- Distinctive: line 143
Read validation. Produce, for each changed tool or sub-agent: the linter diff, the live declaration dump with its byte size, a …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ADK tool interface design
Deliver a small, verified change to what the model sees of a tool (name, description, parameters, result) or of a delegated agent (name, description, request parameters, return path), or an actionable review of those interfaces. Work inside the target's existing tools, agents, pins and tests. The model cannot see Python; it sees one declaration per tool and one result dict per call. Every recommendation here pairs with an observable check.
Inspect before choosing a mode
- Read the tool functions, toolsets, agent definitions (
tools=,sub_agents=,mode=,description=), the instruction text that mentions tools, callbacks that touch tool arguments or results, and the existing tool tests. Note which tools read, which write, and which are server-supplied (MCP, OpenAPI). - Identify the pinned
google-adkandgoogle-genaiversions from the manifests and lockfile. Read compatibility: on 2.8.0 the docstring is the entire description and no per-parameter description reaches the model (Annotatedmetadata is preserved from 2.10.0), so parameter names and the docstring body carry the semantics. Preserve the pin; propose an upgrade as a decision, not a side effect. Run the read-only linter from this skill's directory with an available Python 3.11+ interpreter (interpreters):
python "$SKILL_DIR/scripts/lint_tool_schemas.py" --project . --max-tools 20It parses source with
ast, never imports the project, and prints identifiers, counts andfile:lineonly. Findings are review prompts (missing or one-line docstrings, untyped or generic parameters, mutually exclusive booleans, non-dict or status-less returns, raise without an error dict, blocking I/O in a sync tool, near-duplicate names or descriptions, tool counts, short sub-agent descriptions, identity parameters). Apartial: trueresult means an area was not scanned.If recorded events exist (an
adk websession export or test capture), measure result cost:python "$SKILL_DIR/scripts/report_tool_result_sizes.py" --events events.json- Record the current declaration text and size for each tool you will touch (validation, step 2). This is the "before".
Ask only for decisions the source cannot settle: which tools must stay separate for policy reasons, what result size the application tolerates, and whether a sub-agent needs user interaction.
Choose the relevant path
| Mode | Decision and reference |
| (a) New tool or toolset design | Read the FunctionTool contract for what the pinned version declares, then naming and consolidation for the docstring template, parameter rules and when to merge or split. For more than about 20 tools, or any MCP/OpenAPI toolset, also read tool count and toolsets. |
| (b) Wrong tool or wrong parameter diagnosis | Dump the live declarations and compare against the prompt that failed. Fix the description or name before touching the instruction (naming and consolidation); check the error dicts the model saw before the mistake (results and errors); check the active tool count (tool count). Hand the accuracy measurement to adk-agent-evaluation. |
| (c) Result and context-cost review | Read results and errors: status taxonomy, fields for the next step, pagination and truncation defaults, durable store plus opaque reference, actionable error dicts, treatment of server-supplied text. Measure with the result-size report before and after. |
| (d) Delegation interface review | Read delegation interfaces to choose between chat sub-agents, task, single_turn and AgentTool, set skip_summarization, and write the sub-agent description the parent model will read verbatim. adk-workflow-design owns the control flow; adk-agent-instructions owns the wording. |
| (e) Review or recommendation | Use the references above; report each finding with its file:line, the declaration or result it affects, the observable check that would show the fix, and the evidence label (vendor guidance, documented behaviour, independent evidence, source-verified). Change nothing unless asked. |
A request may need several rows; keep them in one change set and one report.
When the project has agents-cli-manifest.yaml, consult the installed
google-agents-cli-adk-code skill (references/adk-python.md, "Tools", or
the long-horizon-harness recipe for a guard chain and result pruning); if it
is not installed, adk-engineer explains how to get it. Its tool rules are the
scaffold's conventions; the declaration dump on the pinned version decides
what the model sees.
Implement the smallest coherent change
State the affected tools, agents and tests before editing. Then:
- Write the docstring as the whole interface: what it does and returns, when
to use it and when not (name the alternative), one line per parameter with
format and example, and the return structure with its
statusvalues and example dicts. Do not mention the injectedToolContextparameter; the model never sees it and the ADK docs say it can confuse the model. - Name tools
verb_noun, prefix by service when several services are present, and keep names unique per agent; ADK shadows duplicates with a warning. - Prefer few parameters of primitive type (
str,int,float,bool,list[str],dict[str, Any],Optional[T], anEnum). Avoid barelistordict, unions of several types and nested models; check PEP 604 unions andanyOfagainst the pinned builder and API variant. Give defaults only to tuning knobs (page size, format), never to values the user supplies. - Never ask the model for identity, tenant, secrets or the current date; read
them from
ToolContextor configuration (adk-tool-auth-and-secrets). - Return a dict with
statusand, on failure,error_message(orerror) and ahintsaying what to do next; never raise for expected failures and never return a bare string. Bound list sizes with a default and a ceiling; move large payloads to a durable store and return a reference. - Use
async deffor I/O tools so ADK can run independent calls concurrently, and make tools that may be selected together side-effect-safe in any order. - Place guardrails where they belong: argument validation that returns an
error dict in
before_tool_callback(returnNone, not{}, to let the tool run), output trimming or artifact offload inafter_tool_callback, policy that depends onToolContext.stateinside the tool. Budgets and approval policy stay withadk-operational-guardrails. - For delegation, prefer
mode='single_turn'sub-agents over directAgentToolunless you need the isolated session, and write the description as a tool docstring. Wrap built-in tools (Google Search, code execution) in anAgentToolor setbypass_multi_tools_limitwhen other tools are present; see delegation interfaces.
Do not edit generate_content_config.tools; ADK rejects it. Forcing
selection (function_calling_config modes, allowed_function_names) is a
request setting, not prompt text; verify the enum in the pinned google-genai.
Permissions and consequential operations
<!-- shared:consequential-operations-brief -->Inspection is read-only, and code generation authorises no deployment, paid call or live test. Before any consequential operation (an API, billing or quota change, a billable resource, a secret, IAM, a data migration, a deployment, a deletion, or a paid or destructive test), read consequential operations, present the exact scope and limits, obtain explicit approval and end the turn to wait for it. Cleanup is a separate confirmed operation on resources this workflow created.
<!-- /shared:consequential-operations-brief -->Linting is read-only. Changing a docstring or schema changes what the model
may do next; a tool that becomes easier to select is called more often. Before
enabling live tests, show the exact model, project, case count and cost
ceiling; keep paid runs with adk-agent-evaluation. Never widen an MCP allow-list to make a test pass, and
never derive write or confirmation policy from server-supplied annotations.
Validate and finish
Read validation. Produce, for each changed tool or
sub-agent: the linter diff, the live declaration dump with its byte size, a
scripted-model Runner test asserting the tool ran with the designed arguments
and returned the designed shape (including one error branch with its hint),
the result-size report on recorded events, and the per-agent tool count. Then
hand the case set and budgets to adk-agent-evaluation as described in
evaluation hooks; selection and parameter
accuracy on a real model are its results, not this skill's.
Report files changed, commands and actual output. A fact read in the
installed package is offline (source read) and a scripted-model run
local (mocked); every threshold taken from a vendor is vendor-measured. On
a second invocation, reread the existing declarations and tests before adding
another wrapper, toolset or test double.
<!-- shared:evidence-labels-brief -->Label each result with its tier (offline, local, live or release) and
outcome (pass, fail, blocked or not run) as
evidence labels defines them;
earlier, vendor and documentation-only results are historical,
vendor-measured or guidance, never this session's evidence.
<!-- /shared:evidence-labels-brief -->Independent community project; not affiliated with or endorsed by Google.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

