Skip to main content
Glama

read

Read file contents with line numbers, auto-detect encoding for text files, and handle images as base64. Supports reading specific line ranges with offset and limit parameters.

Instructions

Reads a file and returns its contents with line numbers. Encoding-aware: auto-detects file encoding (UTF-8, EUC-KR, Shift-JIS, etc.). Image files (PNG, JPG, GIF, BMP, WebP, TIFF, ICO) are returned as ImageContent (base64). SVG files are returned as text. Supports offset/limit for reading specific line ranges. Negative offset reads from end (e.g. offset=-5 reads last 5 lines). Offset accepts integer, string range "100-200", or [start, end] array.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute path to the file to read
offsetNoLine offset. Integer (1-based, negative=from end), string range 'start-end', or [start,end] array. Default: 0 (all)
limitNoMaximum number of lines to read. Default: 0 (all)

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/knewstimek/agent-tool'

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