---
title: "Designing MCP tools for agents: Lessons from building Datadog’s MCP server"
description: "Thin API wrappers make poor MCP tools: agents flood their context windows, blow token budgets on oversized records, and infer trends from raw samples."
url: "https://swe.quest/articles/designing-mcp-tools-for-agents-lessons-from-building-datadog-s-mcp-server-d09621598f568627"
canonical: "https://www.datadoghq.com/blog/engineering/mcp-server-agent-tools/"
source: "Datadog Engineering"
published: "2026-03-04"
difficulty: "medium"
kind: "Case study"
reading_minutes: 8
tags: ["ai-agents","api-design","llms","observability"]
---

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

A post on [Datadog Engineering](https://swe.quest/sources/datadog.md), published 2026-03-04, 8 min read, Case study. Original: [https://www.datadoghq.com/blog/engineering/mcp-server-agent-tools/](https://www.datadoghq.com/blog/engineering/mcp-server-agent-tools/)

## Summary

Thin API wrappers make poor MCP tools: agents flood their context windows, blow token budgets on oversized records, and infer trends from raw samples. Datadog's MCP server fixes this with token-efficient formats (CSV/TSV for flat data, YAML for nested), trimmed default fields, and pagination by token budget instead of record count, fitting about 5x more records per token. It also exposes a SQL query interface over logs, which made eval runs about 40% cheaper. Other lessons: keep tool count low with flexible tools, opt-in toolsets or layering; return specific, actionable error messages; offer a RAG docs-search tool; and include guidance hints in tool results.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)

## Prerequisites

- Model Context Protocol basics
- LLM context windows and tokens ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- tool calling in LLM agents ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))

## Keywords

Model Context Protocol, Datadog, Claude Code, Cursor, TOON, Bits Investigation, SQL

## Related posts

- [5 Best Practices for Building, Testing, and Packaging MCP Servers](https://swe.quest/articles/5-best-practices-for-building-testing-and-packaging-mcp-servers-156585fac07369be.md): Docker · 2025-07-03 · Medium · 7 min read · AI agents, Containers, API design, Testing
  MCP servers work best when designed around the agent as the real caller: keep a small "tool budget" by grouping endpoints into use-case tools and prompts instead of one tool per API endpoint, and return error messages that tell the agent what to fix (e.g., an invalid API\_TOKEN configuration) rather than human-facing denials.
- [Auto-generating MCP Servers from OpenAPI Schemas: Yay or Nay?](https://swe.quest/articles/auto-generating-mcp-servers-from-openapi-schemas-yay-or-nay-ddbbf7dc3df515f6.md): Neon · 2025-05-01 · Easy · 4 min read · AI agents, API design, LLMs
  Auto-generating an MCP server as a 1:1 mapping of an OpenAPI spec works poorly.
- [Building AI-Powered Observability with Heroku Managed Inference and Agents](https://swe.quest/articles/building-ai-powered-observability-with-heroku-managed-inference-and-agents-c65a18c2ea58a958.md): Heroku Engineering · 2026-02-13 · Medium · 5 min read · AI agents, Observability, Go, Debugging
  Observability platforms like Splunk, Honeycomb and Sentry can be exposed to AI coding assistants as MCP tools, so engineers query production telemetry in natural language from Cursor or Claude instead of switching to dashboards and writing SPL.
- [You are Doing MCP Wrong: 3 Big Misconceptions](https://swe.quest/articles/you-are-doing-mcp-wrong-3-big-misconceptions-4ed8974e9536c439.md): Docker · 2025-09-03 · Medium · 4 min read · AI agents, LLMs, API design, Observability
  MCP is a model-facing protocol for LLM tool use and context exchange, not a replacement for REST or gRPC.
- [Dynamic MCPs with Docker: Stop Hardcoding Your Agents’ World](https://swe.quest/articles/dynamic-mcps-with-docker-stop-hardcoding-your-agents-world-a530a7120388ea63.md): Docker · 2025-11-06 · Medium · 11 min read · AI agents, LLMs, Sandboxing & isolation, Containers, Developer tools
  Docker MCP Gateway now exposes primordial tools (mcp-find, mcp-add) that let agents search a curated catalog of 270+ MCP servers, add them to the live session, and trigger OAuth or elicitation flows, instead of hand-editing JSON config and restarting.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
