Claude Certified Architect – Foundations Practice Question 48: Token Efficient Tool Results

Claude Certified Architect, Foundations · Test 5 · question 8 of 10

Tool Design & MCP Integrationmedium

An agent has a search_tickets tool that returns every matching ticket as a JSON blob with all fields, including full comment histories, and identifies each ticket and assignee by a raw UUID. A broad query often returns tens of thousands of tokens, the agent's context fills up, and it sometimes passes the wrong UUID to a follow-up update_ticket call. Which redesign best addresses both problems?

Select one answer
Show answer and explanation

Answer:

  • C. Add pagination, filters and a concise default response with optional fields, truncate large results with guidance to narrow the query, and return readable identifiers instead of opaque UUIDs.

Anthropic's guidance on writing tools for agents recommends some combination of pagination, range selection, filtering and truncation with sensible defaults, and that truncation messages steer the agent toward more token-efficient strategies, such as several small targeted searches. It also notes that agents handle natural-language names and identifiers far better than cryptic ones, and that replacing arbitrary UUIDs with meaningful identifiers reduces hallucinations and improves retrieval precision. This fixes both the context bloat and the wrong-ID errors at the tool layer.

A is wrong because a larger window only delays the bloat, costs more on every turn, and a prompt reminder does not fix the opaque identifiers. B is wrong because returning bare IDs forces many extra calls (N+1 round trips), adding latency and still using opaque IDs. D is wrong because returning the whole payload every time keeps the context problem and adds server-side state; caching on the server does not change how many tokens the model has to read.

Reference: Writing effective tools for agents

Practice Test 5 ›

Study guides for Claude Certified Architect, Foundations