Filesystem Tools
CTX MCP server includes a comprehensive set of filesystem tools that allow Claude to directly interact with your project files. These tools enable powerful AI-assisted development workflows and make it easy to analyze, modify, and create files without leaving your conversation.
Available Tools
file-read
Reads content from a file with encoding support.
Parameters:
path
(required): Path to the file to readencoding
(optional): File encoding (default: utf-8)
Example:
{
"path": "src/ExampleClass.php"
}
Response: Returns the content of the file as text.
file-write
Writes content to a file with optional directory creation.
Parameters:
path
(required): Relative path to the file (e.g., "src/file.txt")content
(required): Content to write to the filecreateDirectory
(optional): Create directory if it doesn't exist (default: true)
Example:
{
"path": "src/utils/Helper.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nclass Helper\n{\n // Class implementation\n}"
}
Response: Returns a success message with the number of bytes written.
Use Cases
Code Analysis and Modification
Claude can read existing files, analyze them, and suggest modifications or improvements. For example:
- Read a class file to understand its structure
- Analyze dependencies and relationships
- Suggest refactoring or optimization
- Write the modified version back to the file
Code Generation
Claude can generate new files based on your requirements and project context:
- Understand your project structure using context tools
- Generate new classes, interfaces, or utility functions
- Write the generated code to appropriate locations
- Create necessary directories if they don't exist
Project Exploration
Claude can explore your project structure to better understand its organization:
- Get information about directories to understand the project layout
- Examine specific files to understand their purpose and functionality
- Build a mental model of your codebase to provide more relevant assistance
Refactoring and Reorganization
Claude can assist with refactoring and reorganizing your project:
- Rename files to follow naming conventions
- Move files to more appropriate locations
- Create new directory structures for better organization
- Update file content to reflect the new structure