read_skill_file
View the complete contents of files within skill directories, including scripts, configuration files, and documentation, to examine file structure and content before modification or execution.
Instructions
Read and display the complete content of a specific file within a skill directory.
This tool allows you to view the contents of any file in a skill. Use this to:
Read Python scripts, data files, configuration files, etc.
Examine file contents before modifying them
Check file format and structure before running scripts
View documentation or data files
Parameters:
skill_name: The name of the skill directory (e.g., 'my-skill')
file_path: Relative path to the file within the skill directory (e.g., 'scripts/process.py', 'data/input.csv', 'README.md')
Important: file_path is relative to the skill's root directory, not the skills directory. Use forward slashes even on Windows.
Returns: The complete file content as text. If the file is very large, it will be truncated with a message indicating truncation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Relative path to the file within the skill directory (e.g., 'SKILL.md' or 'scripts/process.py') | |
| skill_name | Yes | Name of the skill |
Implementation Reference
- src/skill_mcp/models.py:22-29 (schema)Pydantic input schema for the read_skill_file tool, defining skill_name and file_path parameters.class ReadSkillFileInput(BaseModel): """Input for reading a skill file.""" skill_name: str = Field(description="Name of the skill") file_path: str = Field( description="Relative path to the file within the skill directory (e.g., 'SKILL.md' or 'scripts/process.py')" )
- Supporting utility function that reads the content of a skill file, matching the tool's expected logic with validation for path, existence, and size.def read_file(skill_name: str, file_path: str) -> str: """ Read content of a skill file. Args: skill_name: Name of the skill file_path: Relative path to the file Returns: File content as string Raises: InvalidPathError: If path is invalid FileNotFoundError: If file doesn't exist FileTooBigError: If file exceeds size limit """ full_path = validate_path(skill_name, file_path) if not full_path.exists(): raise FileNotFoundError(f"File '{file_path}' does not exist in skill '{skill_name}'") if not full_path.is_file(): raise FileNotFoundError(f"'{file_path}' is not a file") file_size = full_path.stat().st_size if file_size > MAX_FILE_SIZE: raise FileTooBigError( f"File too large ({file_size / 1024:.1f} KB). " f"Maximum size is {MAX_FILE_SIZE / 1024:.1f} KB." ) return full_path.read_text()