Skip to main content
Glama
abhishekbhakat

mcp-server-code-assist

create_file

Create a new file with specified content at a given path to organize code or documentation in development workflows.

Instructions

Creates a new file with content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
contentNo

Implementation Reference

  • The core handler function for the create_file tool. It delegates to write_file and returns a success message.
    async def create_file(self, path: str, content: str = "") -> str:
        await self.write_file(path, content)
        return f"Created file: {path}"
  • Pydantic model defining the input schema for the create_file tool: path and optional content.
    class FileCreate(BaseModel):
        path: str | Path
        content: str = ""
  • Registers the create_file tool in the MCP server's list_tools with name, description, and input schema.
    Tool(
        name=CodeAssistTools.CREATE_FILE,
        description="Creates a new file with content",
        inputSchema=FileCreate.model_json_schema(),
    ),
  • Server-side handler in call_tool that parses arguments into FileCreate model and invokes the file_tools.create_file method.
    case CodeAssistTools.CREATE_FILE:
        model = FileCreate(path=arguments["path"], content=arguments["content"])
        result = await file_tools.create_file(model.path, model.content)
        return [TextContent(type="text", text=result)]
  • Helper method called by create_file to perform the actual file writing after validation.
    async def write_file(self, path: str, content: str) -> None:
        path = await self.validate_path(path)
        try:
            path.parent.mkdir(parents=True, exist_ok=True)
            path.write_text(content)
        except Exception as e:
            self.handle_error(e, {"operation": "write", "path": str(path)})
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. It states the action ('creates') but doesn't mention permissions needed, whether it overwrites existing files, error conditions, or what happens on success. This leaves significant gaps for a mutation tool.

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 a single, efficient sentence with zero wasted words. It's appropriately sized for a basic tool and front-loads the essential information.

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 creation tool with 2 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the tool returns, error conditions, or important behavioral aspects like whether it overwrites existing files at the same path.

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?

Schema description coverage is 0%, so the description must compensate but doesn't. It mentions 'content' but not 'path', and provides no details about parameter formats, constraints, or relationships. Both parameters remain essentially undocumented beyond their schema titles.

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 clearly states the action ('creates') and resource ('new file with content'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'modify_file' or 'rewrite_file', which also involve file content manipulation.

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?

No guidance is provided about when to use this tool versus alternatives like 'modify_file' (for existing files) or 'create_directory' (for directories). The description offers no context about prerequisites, constraints, or appropriate scenarios for file creation.

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/abhishekbhakat/mcp_server_code_assist'

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