update_files
Replace file responses in the RequestRepo MCP server to manage HTTP request data, headers, and status codes for web inspection and sharing.
Instructions
Replace all file responses.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | ||
| confirm | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/requestrepo_mcp/server.py:293-312 (handler)Main handler implementation in RequestrepoMCPService.update_files that validates input, converts FileResponseInput to Response objects, requires confirmation, calls the client's update_files method, and returns status.
def update_files(self, *, files: dict[str, FileResponseInput], confirm: bool) -> dict[str, Any]: self._require_confirm(confirm, "update_files") payload: dict[str, Response] = {} for path, file_response in files.items(): try: base64.b64decode(file_response.raw_base64, validate=True) except binascii.Error as exc: raise ValueError(f"files[{path!r}].raw_base64 must be valid base64: {exc}") from exc payload[path] = Response( raw=file_response.raw_base64, headers=[ Header(header=header.header, value=header.value) for header in file_response.headers ], status_code=file_response.status_code, ) updated = self._client().update_files(payload) return {"updated": updated, "count": len(payload)} - src/requestrepo_mcp/server.py:475-478 (registration)MCP tool registration using @mcp.tool() decorator that exposes update_files as a callable tool with description and delegates to the service method.
@mcp.tool() def update_files(files: dict[str, FileResponseInput], confirm: bool) -> dict[str, Any]: """Replace all file responses.""" return resolved_service.update_files(files=files, confirm=confirm) - src/requestrepo_mcp/schemas.py:28-34 (schema)Pydantic BaseModel for FileResponseInput defining the input schema with raw_base64 string, optional headers list, and status_code with validation constraints.
class FileResponseInput(BaseModel): """File response payload for update_files.""" raw_base64: str headers: list[HeaderInput] = Field(default_factory=list) status_code: int = Field(default=200, ge=100, le=599)