Skip to content

Standardize error response format in test Lambda function #3

@longwind48

Description

@longwind48

Problem

The test Lambda function (src/lambda/mcp_servers/test/lambda_function.py) uses inconsistent response formats:

Error responses return HTTP-style objects:

return {"statusCode": 400, "body": json.dumps({"error": "message parameter is required"})}
return {"statusCode": 404, "body": json.dumps({"error": f"Unknown tool: {tool_name}", ...})}

Success responses return plain dicts:

return {"message": f"Hello, {name}!", ...}

Other MCP Lambda functions (athena, cost_explorer, cur_analyst) consistently return plain dicts for both success and error:

return {"error": str(e)}  # errors
return {"results": [...]}  # success

Expected Behavior

The test Lambda should follow the same pattern as other MCP Lambda functions — return plain dicts without HTTP status codes wrapping.

Scope

  • Update error returns in src/lambda/mcp_servers/test/lambda_function.py to use {"error": "..."} format
  • Remove statusCode and body wrapping from error responses
  • Keep success response format as-is (already plain dict)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions