Summary
The gateway supports a redundancy query parameter on POST /api/v1/data/ for erasure coding (values 0-4). Higher redundancy increases data availability at the cost of more storage usage.
What to Implement
1. Gateway Client (gateway_client.py)
Add redundancy parameter to upload_data():
def upload_data(self, data: str, stamp_id: str, content_type: str = "application/json",
sign: Optional[str] = None, redundancy: Optional[int] = None) -> Dict[str, Any]:
When provided, include as query parameter:
if redundancy is not None:
params['redundancy'] = redundancy
2. MCP Server (server.py)
Add to upload_data tool schema:
"redundancy": {
"type": "integer",
"description": "Erasure coding redundancy level (0-4). Higher values increase data availability and resilience at the cost of more storage. 0 = no redundancy (default), 4 = maximum redundancy.",
"minimum": 0,
"maximum": 4
}
3. Validation
Add validation in the handler:
redundancy = arguments.get("redundancy")
if redundancy is not None and not (0 <= redundancy <= 4):
raise ValueError("Redundancy must be between 0 and 4")
Files to Modify
swarm_provenance_mcp/gateway_client.py — add redundancy param
swarm_provenance_mcp/server.py — add to tool schema and handler
tests/test_gateway_client.py — add tests
tests/test_integration.py — add integration tests
Acceptance Criteria
Summary
The gateway supports a
redundancyquery parameter onPOST /api/v1/data/for erasure coding (values 0-4). Higher redundancy increases data availability at the cost of more storage usage.What to Implement
1. Gateway Client (
gateway_client.py)Add
redundancyparameter toupload_data():When provided, include as query parameter:
2. MCP Server (
server.py)Add to
upload_datatool schema:3. Validation
Add validation in the handler:
Files to Modify
swarm_provenance_mcp/gateway_client.py— addredundancyparamswarm_provenance_mcp/server.py— add to tool schema and handlertests/test_gateway_client.py— add teststests/test_integration.py— add integration testsAcceptance Criteria
upload_dataaccepts optionalredundancyparameter (0-4)