Skip to main content
Glama

write

Write content to files in virtual filesystem workspaces. Use this tool to save text data to files across multiple storage providers with session, user, or shared scope access.

Instructions

Write content to file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestYes

Implementation Reference

  • VFSTools.write: the core handler implementing file write logic, resolving path, creating parents, encoding content, and writing to VFS.
    async def write(self, request: WriteRequest) -> WriteResponse:
        """
        Write content to file.
    
        Args:
            request: WriteRequest with path and content
    
        Returns:
            WriteResponse with success status
        """
        from pathlib import PurePosixPath
    
        vfs = self.workspace_manager.get_current_vfs()
        resolved_path = self.workspace_manager.resolve_path(request.path)
    
        # Ensure all parent directories exist
        # Use PurePosixPath to ensure forward slashes on all platforms
        parent = str(PurePosixPath(resolved_path).parent)
        if parent != "/":
            # Create all parent directories if they don't exist
            parts = [p for p in parent.split("/") if p]
            current_path = ""
            for part in parts:
                current_path += f"/{part}"
                if not await vfs.exists(current_path):
                    await vfs.mkdir(current_path)
    
        content_bytes = request.content.encode("utf-8")
        await vfs.write_file(resolved_path, content_bytes)
    
        return WriteResponse(success=True, path=resolved_path, size=len(content_bytes))
  • Pydantic models: WriteRequest (path, content) and WriteResponse (success, path, size).
    class WriteRequest(BaseModel):
        """Request to write a file"""
    
        path: str
        content: str
    
    
    class WriteResponse(BaseModel):
        """Response from write operation"""
    
        success: bool
        path: str
        size: int
  • MCP server tool registration for 'write', delegating to VFSTools instance.
    @server.tool
    async def write(request: WriteRequest):
        """Write content to file."""
        return await vfs_tools.write(request)
  • Instantiation of VFSTools instance used by all VFS tools including write.
    vfs_tools = VFSTools(workspace_manager)
    checkpoint_tools_instance = CheckpointTools(checkpoint_manager)
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Write content to file' implies a mutation operation but doesn't specify whether it overwrites or appends, what happens with non-existent files, what permissions are required, or what the response looks like. For a file system mutation tool, this leaves critical behavioral questions unanswered.

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

Conciseness5/5

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

The description is maximally concise at just four words, front-loading the essential information with zero wasted words. Every word earns its place in communicating the core functionality.

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

Completeness2/5

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

For a file system write operation with no annotations, no output schema, and undocumented parameters, the description is insufficiently complete. It doesn't address critical context like file creation behavior, overwrite policies, error conditions, or return values, leaving the agent with significant uncertainty about how to use this tool effectively.

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

Parameters2/5

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

With 0% schema description coverage and a single undocumented parameter named 'request', the description adds no parameter semantics beyond the tool's general purpose. It doesn't explain what 'request' should contain (file path? content? both?), what format it expects, or how the parameter relates to the writing operation.

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

Purpose4/5

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

The description 'Write content to file' clearly states the action (write) and target resource (file), making the purpose immediately understandable. However, it doesn't differentiate from sibling 'read' tool beyond the basic verb difference, missing opportunity to clarify this is for output rather than input operations.

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

Usage Guidelines2/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 like 'cp' (copy) or 'mv' (move), nor does it mention prerequisites like file existence or permissions. It simply states what the tool does without contextual usage information.

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/IBM/chuk-mcp-vfs'

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