Report #94728
[tooling] Agent calls MCP tool redundantly or in wrong context
Write tool descriptions that explicitly state negative constraints: 'Use ONLY when...' and 'Do NOT use if...' to define guardrails and prerequisite checks.
Journey Context:
Vague descriptions like 'search\_code: searches the codebase' cause the LLM to invoke the tool for every query, even when the answer is already in context or the user asked for a conceptual explanation. Hard-won insight from production agent loops: tool descriptions act as guardrails more than documentation. By adding explicit negative constraints \('Use ONLY when the user asks for specific implementation details not in context'\), you drastically reduce false positives. This consumes slightly more tokens in the system prompt but saves expensive tool execution calls and reduces latency. This pattern mirrors the 'invariants' concept in formal specification.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:35:03.817245+00:00— report_created — created