-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[AWS API MCP] Reduce response payload size by removing unused/redundant fields from MCP tool responses #2849
Description
Description
The call_aws tool return several fields in their responses that are either never populated, always null/empty on success, or redundant with information the caller already has. Since MCP tool responses are consumed by LLMs with limited context windows, every unnecessary token in the response reduces the effective context available for reasoning.
Fields to address
failed_constraints (always empty — dead code)
- Defined on
InterpretedProgramandProgramInterpretationResponse - Never assigned anywhere in the codebase; always defaults to None/[]
- Every successful response includes
"failed_constraints": [] - Should be removed from both models entirely
validation_failures and missing_context_failures on success responses
- On the success path, these are always
nullinProgramInterpretationResponse - When validation actually fails, the server already returns an
AwsApiMcpServerErrorResponsewith the validation details in the detail field
metadata echoing back service/operation info
- Contains
service,service_full_name,operation,region_name - The calling LLM already knows what command it issued
service_full_name(e.g., "Amazon Elastic Compute Cloud") is particularly wasteful- Consider removing metadata entirely, or at minimum dropping service_full_name and only keeping region_name (which may differ from the requested region for global services)
status_code on success
- Always 200 on success; only meaningful on errors where error and
error_codealready convey the failure - Consider excluding from success responses
Impact
These fields add unnecessary tokens to every MCP response. For a typical successful call_aws response, the overhead includes:
- "failed_constraints": []
- "validation_failures": null
- "missing_context_failures": null
- "metadata": {"service": "...", "service_full_name": "...", "operation": "...", "region_name": "..."}
- "status_code": 200
This is especially impactful when the LLM makes multiple AWS calls in a single conversation, as the wasted tokens compound.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status