Skip to content

[AWS API MCP] Reduce response payload size by removing unused/redundant fields from MCP tool responses #2849

@PCManticore

Description

@PCManticore

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 InterpretedProgram and ProgramInterpretationResponse
  • 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 null in ProgramInterpretationResponse
  • When validation actually fails, the server already returns an AwsApiMcpServerErrorResponse with 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_code already 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

aws-api-mcpIssue related to AWS API MCP server

Type

No type

Projects

Status

To triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions