You are building developer productivity tools using the Claude Agent SDK. The agent helps engineers explore unfamiliar codebases, understand legacy systems, generate boilerplate code, and automate repetitive tasks. It uses the built-in tools (Read, Write, Bash, Grep, Glob) and integrates with Model Context Protocol (MCP) servers.
After 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?