Skip to main content
Glama
hofill
by hofill

set_file

Configure HTTP responses for specific file paths by setting status codes, headers, and content to simulate server behavior for testing and development.

Instructions

Set one file response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
confirmYes
body_textNo
body_base64No
status_codeNo
headersNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The set_file handler method in RequestrepoMCPService that contains the core business logic: validates confirm flag, checks that exactly one of body_text or body_base64 is provided, decodes base64 if needed, converts header models, and calls the underlying client.set_file method.
    def set_file(
        self,
        *,
        path: str,
        confirm: bool,
        body_text: str | None = None,
        body_base64: str | None = None,
        status_code: int = 200,
        headers: list[HeaderInput] | None = None,
    ) -> dict[str, Any]:
        self._require_confirm(confirm, "set_file")
        if (body_text is None) == (body_base64 is None):
            raise ValueError("Provide exactly one of body_text or body_base64.")
    
        body: str | bytes
        if body_base64 is not None:
            try:
                body = base64.b64decode(body_base64, validate=True)
            except binascii.Error as exc:
                raise ValueError(f"body_base64 must be valid base64: {exc}") from exc
        else:
            body = body_text if body_text is not None else ""
    
        header_models = [Header(header=header.header, value=header.value) for header in (headers or [])]
        updated = self._client().set_file(path, body, status_code=status_code, headers=header_models)
        return {
            "updated": updated,
            "path": path,
            "status_code": status_code,
            "headers": [header.model_dump() for header in header_models],
        }
  • The MCP tool registration for set_file using the @mcp.tool() decorator, which exposes the set_file functionality to the MCP protocol. This function wraps the service method and defines the tool signature.
    @mcp.tool()
    def set_file(
        path: str,
        confirm: bool,
        body_text: str | None = None,
        body_base64: str | None = None,
        status_code: int = 200,
        headers: list[HeaderInput] | None = None,
    ) -> dict[str, Any]:
        """Set one file response."""
        return resolved_service.set_file(
            path=path,
            confirm=confirm,
            body_text=body_text,
            body_base64=body_base64,
            status_code=status_code,
            headers=headers,
        )
  • The HeaderInput schema class that defines the structure for HTTP headers used in set_file and other file response operations.
    class HeaderInput(BaseModel):
        """HTTP header payload for file responses."""
    
        header: str
        value: str
  • The FileResponseInput schema class that defines the structure for file responses, used by update_files (related to set_file functionality).
    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)
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Set one file response' implies a write/mutation operation, but the description doesn't reveal what 'set' actually does (creates, overwrites, configures?), whether it's destructive, what permissions are needed, what happens on success/failure, or any rate limits. This leaves critical behavioral traits completely undocumented.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (4 words), which could be efficient if it were informative. However, this brevity results in severe under-specification rather than effective communication. While it's front-loaded with the core action, every word fails to earn its place by adding meaningful value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's apparent complexity (6 parameters including binary data and HTTP headers), the complete lack of annotations, and the description's failure to explain what the tool does, when to use it, or what parameters mean, this description is completely inadequate. The existence of an output schema doesn't compensate for these fundamental gaps in understanding the tool's purpose and behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 6 parameters (2 required), the description provides absolutely no information about what any parameter means or how they interact. Parameters like 'path', 'confirm', 'body_text', 'body_base64', 'status_code', and 'headers' are completely unexplained, leaving the agent to guess their purpose and usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Set one file response' is essentially a tautology that restates the tool name 'set_file' with minimal elaboration. It doesn't specify what 'file response' means in context, what resource is being set, or how this differs from sibling tools like 'update_files' or 'get_file'. The purpose remains vague despite the tool name providing some clue.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There are multiple sibling tools that might handle files or responses (e.g., 'get_file', 'update_files', 'list_files'), but the description offers no context about when this specific tool is appropriate, what prerequisites exist, or when to choose other tools instead.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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