Designing MCP tools for agents: Lessons from building Datadog’s MCP server | Datadog

This post details the evolution of Datadog's MCP server to improve observability for AI agents. Key technical contributions include: optimizing data formats from JSON to CSV/YAML for token efficiency (achieving up to 5x more records per token), implementing token-budget-based pagination instead of record-count pagination, introducing SQL as a query language for agents to retrieve specific data rather than raw logs (reducing costs by ~40% in eval scenarios), designing flexible tools and toolsets to manage tool count, exploring layering for specialized functionality (trading latency for reduced context), improving error messages for agent recoverability, and making documentation discoverable via a RAG-powered search tool. The post also discusses the trade-offs between specialized agents and general MCP servers.