Tool Design & MCP Integration

5 build exercises to practise the concepts in this domain.

2.1Design Tool Descriptions That Eliminate Misrouting

Beginner
30 minutes
  • Understand that tool descriptions are the primary mechanism LLMs use for tool selection
  • Write production-grade descriptions with purpose, inputs, examples, edge cases, and boundaries
  • Diagnose misrouting caused by ambiguous or overlapping descriptions
  • Identify system prompt conflicts that override well-written tool descriptions

2.2Build Structured Error Responses for All Four Categories

Intermediate
45 minutes
  • Implement structured error responses with errorCategory, isRetryable, and description metadata
  • Distinguish between access failures (isError: true) and valid empty results (isError: false)
  • Categorise tool failures into transient, validation, business, and permission types
  • Build agent recovery logic that takes different actions based on error metadata

2.3Configure Tool Distribution Across a Multi-Agent System

Intermediate
45 minutes
  • Scope tools to agent roles using the 4-5 tools per agent guideline
  • Implement scoped cross-role tools to avoid coordinator round-trip latency
  • Configure tool_choice modes (auto, any, forced) for different workflow requirements
  • Apply least-privilege tool design by replacing generic tools with constrained alternatives
  • Verify that tool distribution prevents cross-role misuse in multi-agent systems

2.4Configure MCP Servers with Scoping and Environment Variables

Beginner
30 minutes
  • Configure project-level MCP servers in .mcp.json for team-wide sharing
  • Use environment variable expansion to keep credentials out of version control
  • Distinguish between project-level and user-level MCP configuration scoping
  • Expose MCP resources to reduce unnecessary exploratory tool calls
  • Write enhanced MCP tool descriptions that compete with built-in tool descriptions

2.5Trace and Refactor a Deprecated Function Using Built-in Tools

Intermediate
30 minutes
  • Apply Grep for content search and Glob for path matching in the correct sequence
  • Use incremental codebase discovery instead of reading all files upfront
  • Select Edit as the primary modification tool, with Read + Write as a fallback
  • Trace function usage across wrapper modules and barrel files
  • Follow the Grep-then-Glob pattern for finding callers and their test files