Skip to main content
Glama

head

Read-only

Preview the first N lines of files or stdin as JSON. Supports negative-N to skip all but last N lines and --raw for plain text.

Instructions

Return the first N lines (default 10) of files or stdin as JSON. Read-only, no side effects. Returns JSON with line array by default; use --raw for plain text. Supports negative-N to skip all but the last N lines. Use to preview file beginnings or extract headers. Not for viewing file endings — use 'tail' for the last N lines. See also 'tail', 'cat'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rawNoWrite raw selected lines without a JSON envelope.
pathYesFile to read.
linesNoNumber of lines.
encodingNoText encoding (default: utf-8). Use 'auto' for BOM/autodetection.utf-8
show_encodingNoInclude encoding detection metadata in JSON result.
encoding_errorsNoHow to handle encoding errors (default: replace).replace
encoding_profileNoLocale-aware encoding fallback profile for auto-detection.
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true. Description adds behavioral details beyond annotations: 'Read-only, no side effects', support for negative N, and dual output modes (JSON vs raw). This provides useful transparency for an agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four sentences, each with a distinct purpose: purpose, safety, special behavior, usage guidance. Extremely concise with no filler. Information is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers key aspects: default behavior, output format, negative-N, encoding though partially via schema, and stdin support. Lacks details on return structure beyond line array, but sufficient for a simple tool. No output schema but description compensates.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. Description adds value by explaining the negative-N behavior for the 'lines' parameter and mentioning the raw output mode, which goes beyond schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool returns the first N lines of files or stdin as JSON, with specific verb and resource. Explicitly distinguishes from sibling 'tail' for viewing endings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear usage context: 'Use to preview file beginnings or extract headers.' Explicitly states when not to use it: 'Not for viewing file endings — use tail for the last N lines.' Mentions alternatives 'tail' and 'cat'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/caseSHY/AI-CLI'

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