Gemini function calling: what 40 extra tools add to a request

On Ofox, Gemini 4 Neon used 171 input tokens with two tools and 13,791 with 42. Compare four receipts and check your own function schemas.

A wall of closed drawers with one drawer pulled out and an orange card lifted from it, standing for a tool schema loaded only when needed

A customer requested a refund. Gemini first chose the order lookup tool. With two available tools, Gemini 4 Neon read 171 input tokens. With 42, it read 13,791 and still picked the same function. Choosing the tool list for each step can matter more than shortening the customer’s question.

Two tools versus 42

Both runs with 2 tools used 171 input tokens. Both runs with 42 tools used 13,791.

RunToolsInput tokensCached inputOutput tokens (of which reasoning)Time
Small, 1st2171Unreported151 (124)4.6 s
Small, 2nd2171Unreported151 (124)4.6 s
Large, 1st4213,791Unreported224 (197)24.9 s
Large, 2nd4213,79111,737167 (140)17.5 s

What the 85.1% cache share means for your bill

For the second large request, input cost can be calculated as (2,054 × regular input price + 11,737 × cached input price) ÷ 1,000,000 when both prices are quoted per million tokens. Add output separately. If both input rates are equal, that cache hit saves nothing on input charges. For the other three requests the cache field was absent.

Choose tools by task

For an order lookup, send the lookup function first. Add a refund function only after the workflow reaches a refund decision. Before deploying a shorter list, replay one order lookup and one refund request. Check the selected function and arguments as well as input usage: a smaller prompt is only useful if the agent can still finish the job.

Check the schema overhead in your own responses

Save two complete, non-streaming Chat Completions responses as small.json and large.json. Keep the model, user message and tool-choice setting fixed. Change only the tool list. Save the reader below as usage.py and run python3 usage.py small.json large.json.

import json
import sys

for filename in sys.argv[1:]:
    with open(filename, encoding="utf-8") as stream:
        usage = json.load(stream)["usage"]
    total = usage["prompt_tokens"]
    cached = (usage.get("prompt_tokens_details") or {}).get("cached_tokens")
    print(filename, "input:", total, "cached:", cached,
          "output:", usage["completion_tokens"])

Subtract the smaller input count from the larger one and divide by the number of definitions added. For the archived pair, (13,791 − 171) ÷ 40 = 340.5 tokens per added definition. That average depends on schema length. A cached value of None means the field was absent. Leave the cache-adjusted cost unknown for that run.

When to evaluate Tool Retrieval

When the next tool cannot be predicted from the workflow, deferred loading is a separate option to evaluate. Compare the same order task with retrieval enabled and disabled, then inspect the tool selected, the final order result and total input across all steps. The figures above cover ordinary function calling on Ofox.

Left: ordinary function calling puts every tool's full schema in the prompt. Right: with Tool Retrieval the prompt holds a tool_search entry and only names and descriptions, and one schema is loaded on demand

Method

Four Ofox calls on November 20, 2026, two per list size. All four selected search_orders. The test measured tool definitions and did not run a retrieval-enabled comparison.

Troubleshoot Gemini API errors

Frequently Asked Questions

How much input did each extra tool add?
The 40 extra definitions added 13,620 input tokens, averaging 340.5 per definition. Each extra definition had eight described string fields.
What did the second 42-tool request cache?
The receipt reported 11,737 cached tokens out of 13,791 input tokens (85.1%). The remaining 2,054 were outside that count.