Skip to main content
Glama
hofill
by hofill

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

TableJSON Schema
NameRequiredDescriptionDefault
filesYes
confirmYes

Implementation Reference

  • 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)}
  • 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)
  • 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hofill/RequestRepo-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server