# Read Text File

> Read the complete contents of a file from the file system as text. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Use the 'head' parameter to read only the first N lines of a file, or the 'tail' parameter to read only the last N lines of a file. Operates on the file as text regardless of extension. Only works within allowed directories.

- Skill: `xiaobai1017/read-text-file` (Agent Skill)
- Install (CLI): `npx skillmds@latest add xiaobai1017/read-text-file`
- Raw SKILL.md: https://api.skillmd.com/api/skills/xiaobai1017/read-text-file/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: xiaobai1017 (https://skillmd.com/u/xiaobai1017)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/xiaobai1017/read-text-file

---


# Read Text File

Read the complete contents of a file from the file system as text. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Use the 'head' parameter to read only the first N lines of a file, or the 'tail' parameter to read only the last N lines of a file. Operates on the file as text regardless of extension. Only works within allowed directories.

## Purpose

This skill provides access to the MCP tool `read_text_file`. It allows you to read the complete contents of a file from the file system as text. handles various text encodings and provides detailed error messages if the file cannot be read. use this tool when you need to examine the contents of a single file. use the 'head' parameter to read only the first n lines of a file, or the 'tail' parameter to read only the last n lines of a file. operates on the file as text regardless of extension. only works within allowed directories..

## Parameters

The tool accepts the following parameters:

### `path`
**Required**
- **Type**: `string`
- **Description**: No description provided

### `tail`
*Optional*
- **Type**: `number`
- **Description**: If provided, returns only the last N lines of the file

### `head`
*Optional*
- **Type**: `number`
- **Description**: If provided, returns only the first N lines of the file


## Usage Instructions

To use this tool:

1. **Prepare the parameters** according to the schema above
2. **Invoke the MCP tool** `read_text_file` with the prepared parameters
3. **Process the result** returned by the tool

## Example

```json
{
  "path": "example_value",
  "tail": 123,
  "head": 123
}
```

## Expected Output

The tool returns data with the following structure:

- **content** (`string`): No description provided


## Notes

- This skill requires an active MCP connection to the server providing the `read_text_file` tool
- Ensure the MCP server is properly configured and running before attempting to use this tool
- Review the parameter requirements carefully to avoid errors
