惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale
博客园 - 【当耐特】
博客园_首页
The GitHub Blog
The GitHub Blog
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
有赞技术团队
有赞技术团队
博客园 - 三生石上(FineUI控件)
D
Docker
Stack Overflow Blog
Stack Overflow Blog
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
小众软件
小众软件
I
InfoQ
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
S
SegmentFault 最新的问题
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - Franky

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
MCP Tool Output Budget Checklist
Rhumb · 2026-05-18 · via DEV Community

Rhumb

A tool call can be correct and still break the agent if it returns too much.

Search results, files, transcripts, logs, browser scrapes, and nested API responses need bounded output contracts so the model receives the smallest safe evidence, not a context flood.

Fast answer

  • Tool output is part of the route budget. A verbose MCP result can burn more model context than the call that produced it, then make the next planning step slower, more expensive, and less recoverable.
  • A production MCP tool needs an output contract before launch: maximum bytes, maximum records, schema shape, summary rule, artifact handoff, redaction policy, and the exact denial or truncation receipt when the response exceeds budget.
  • The useful test is not whether the tool can return a large JSON blob. It is whether the same route can return the minimum safe result, point to a durable artifact when needed, and prove what was omitted.
  • If the trace cannot explain how many bytes or tokens were returned, why the payload was shaped that way, what artifact holds the full result, and how the agent can request the next page safely, the route is not ready for unattended loops.

Production checklist

1. Per-route output ceiling

Set a maximum response size by route, not just by server.

A search result, file summary, database row read, transcript extract, and browser scrape should not share one generic payload limit.

2. Schema before prose

Return typed fields, stable ids, result counts, omitted-count metadata, and next-page cursors before free-form explanation.

Let the model reason over bounded structure instead of raw dumps.

3. Artifact handoff

When the full payload is too large, write it to a durable artifact or provider object and return:

  • reference
  • checksum
  • expiration
  • access rule
  • safe follow-up route

Do that instead of flooding context.

4. Summarization boundary

Name whether the tool returned:

  • raw data
  • extracted fields
  • a lossy summary
  • a sampled preview

The receipt should make lossy compression visible before the agent treats it as ground truth.

5. Redaction and data-use policy

Apply redaction before payload shaping.

Record which secret, customer-data, credential, prompt, or topology class was removed. Truncation is not a security control.

6. Pagination and refill rule

Expose a cursor, range, query refinement, or approval step for more data.

Do not let the agent repeat the same oversized call hoping the next response is smaller.

Failure fixtures

Test the context-flood cases before the agent discovers them in production.

Oversized search result

Expected: return top bounded results, total count, omitted count, ranking criteria, and a cursor or refinement hint. Do not stream every match into context.

Large file or transcript

Expected: return section summaries plus artifact reference, byte range, checksum, and follow-up extraction route instead of a full dump.

Nested JSON response

Expected: flatten or select approved fields, include schema version, and receipt omitted nested objects before the agent plans from partial data.

Sensitive field in allowed result

Expected: redact before truncation and record the protected class.

A payload clipped after the secret is already returned fails the gate.

Agent asks for “everything” again

Expected: deny or require a narrower query after budget exhaustion.

The planner should not bypass the output budget by rephrasing the same broad request.

Trace fields

The output receipt should make omitted data auditable.

Once the agent moves on, operators need to know whether it acted on raw data, an extraction, a summary, or a clipped preview. The trace should keep returned payload size, omitted data, redaction, artifact references, and allowed next actions in one place.

Useful trace fields:

  • route id and tool call id
  • caller / tenant / workspace
  • operation class and data class
  • output ceiling in bytes / records / tokens
  • actual bytes and estimated tokens returned
  • raw count, returned count, and omitted count
  • schema version and selected fields
  • redaction rule and protected class
  • summary / extract / raw-data mode
  • artifact id, checksum, and expiration
  • cursor, range, or refill route
  • policy decision and denial / truncation code
  • receipt id and allowed next action

Copy-paste route card

MCP route:
Caller / tenant:
Data class:
Max bytes / records / tokens:
Allowed fields / schema:
Summary vs raw-data rule:
Artifact handoff rule:
Redaction rule:
Pagination / refill route:
Oversize denial or truncation code:
Receipt fields:

Enter fullscreen mode Exit fullscreen mode

Common misreads

  • Optimizing provider-call retries while ignoring that the returned payload is what actually explodes the model bill.
  • Calling a tool read-only and therefore safe, even though it can leak private data or swamp context with unbounded output.
  • Returning a natural-language summary without saying which fields were dropped, sampled, redacted, or inferred.
  • Using truncation as a quiet success path. The agent must know the response is partial before it takes action.
  • Storing a full artifact without a checksum, expiration, access rule, or route for retrieving a narrower slice later.
  • Letting the agent retry the same broad query after an output-budget denial instead of requiring a smaller query or human approval.

The full checklist is on Rhumb: https://rhumb.dev/blog/mcp-tool-output-budget-checklist