list_files
Retrieve all stored file responses to access captured web request data for inspection and management.
Instructions
List all file responses.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_files"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/requestrepo_mcp/server.py:234-242 (handler)The actual list_files implementation in RequestrepoMCPService class. Retrieves all file responses from the requestrepo client and returns a dictionary with count and serialized file data.
def list_files(self) -> dict[str, Any]: files = self._client().files() return { "count": len(files), "files": { path: serialize_file_response(response, decode_base64=False, max_bytes=self.config.max_bytes) for path, response in files.items() }, } - src/requestrepo_mcp/server.py:446-449 (registration)MCP tool registration for list_files using @mcp.tool() decorator. This function exposes the list_files functionality through the MCP protocol by delegating to resolved_service.list_files().
@mcp.tool() def list_files() -> dict[str, Any]: """List all file responses.""" return resolved_service.list_files() - The serialize_file_response helper function used by list_files to convert Response objects into dictionaries containing raw_base64, headers, status_code, and optionally raw_decoded data.
def serialize_file_response( response: Response, *, decode_base64: bool, max_bytes: int, ) -> dict[str, Any]: payload: dict[str, Any] = { "raw_base64": response.raw, "headers": [serialize_header(header) for header in response.headers], "status_code": response.status_code, } if decode_base64: try: decoded = base64.b64decode(response.raw, validate=True) except binascii.Error as exc: payload["raw_decoded"] = None payload["decode_error"] = str(exc) else: payload["raw_decoded"] = bytes_envelope(decoded, max_bytes=max_bytes) return payload