Skip to main content
Glama

Filesystem MCP Server

Official
MIT License
133,342
63,134
  • Linux
  • Apple

read_text_file

Extract and read the contents of a text file from the filesystem. Specify the file path, and optionally retrieve only the first or last N lines for focused analysis. Handles various text encodings and provides clear error messages.

Instructions

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.

Input Schema

NameRequiredDescriptionDefault
headNoIf provided, returns only the first N lines of the file
pathYes
tailNoIf provided, returns only the last N lines of the file

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "head": { "description": "If provided, returns only the first N lines of the file", "type": "number" }, "path": { "type": "string" }, "tail": { "description": "If provided, returns only the last N lines of the file", "type": "number" } }, "required": [ "path" ], "type": "object" }

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/modelcontextprotocol/filesystem'

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