Claude Certified Architect – Foundations Practice Question 87: Programmatic Tool Calling

Claude Certified Architect, Foundations · Test 9 · question 7 of 10

Tool Design & MCP Integrationmedium

An expense-audit agent must check 20 employees against budget limits. Each lookup tool call returns thousands of expense line items, and today every result passes through the model: 20 round trips, a bloated context window, and high latency. Only the few employees who exceeded their limits matter for the final answer. Which design addresses this most directly?

Select one answer
Show answer and explanation

Answer:

  • D. Enable the code execution tool and set allowed_callers on the lookup tool so Claude's script calls it in a loop and returns only a summary

D is correct. Programmatic tool calling lets Claude write code that calls your tools inside a code execution container, instead of a model round trip per call. The script can loop over the 20 lookups, filter or aggregate, and return only the relevant lines; intermediate results are not loaded into Claude's context window. A tool opts in through allowed_callers (for example code_execution_20260120) alongside the code execution tool.

A is wrong because tool search reduces the cost of large tool definitions, not of large tool results. B is wrong because caching lowers the price of re-reading a prefix, but the thousands of line items still enter context and the round trips remain. C is wrong because context editing clears results after they have already consumed context once, and does not remove the 20 sequential round trips.

Reference: Programmatic tool calling - Claude API Docs

Practice Test 9 ›

Study guides for Claude Certified Architect, Foundations