Question 70
An Agent SDK tool helps engineers explore unfamiliar codebases, understand legacy systems, generate boilerplate and automate repetitive tasks, using the built-in tools (Read, Write, Bash, Grep, Glob) plus MCP servers.
Read the full scenario lessonAfter integrating a local MCP server providing code analysis tools (analyze_dependencies, find_dead_code, calculate _complexity), you verify the server is healthy and tools appear in the tools/list response. However, you observe that the agent consistently uses Grep to search for import statements instead of calling analyze_dependencies –even when users explicitly ask about “code dependencies.”
Examining tool definitions reveals:
• MCP: analyze_ dependencies – “Analyzes dependency graph”
• Built-in: Grep – “Search file contents for a pattern using regular expressions. Returns matching lines with line numbers and surrounding context.”
What's the most effective approach to improve the agent's selection of MCP tools?