Skip to main content
Glama

faf_read

Read content from any file on your local filesystem by providing an absolute or relative path.

Instructions

Read content from any file on the local filesystem

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute or relative file path to read

Implementation Reference

  • The main handler function for faf_read: validates the path with PathValidator, checks file size, reads the file with a 30-second timeout, and returns the file content with metadata (duration, file size, resolved path).
    export async function handleFafRead(args: any): Promise<CallToolResult> {
      const startTime = Date.now();
      
      try {
        const { path: filePath } = args;
        
        // Validate path
        const pathValidation = PathValidator.validate(filePath);
        if (!pathValidation.valid) {
          return {
            content: [{
              type: 'text',
              text: `❌ Security error: ${pathValidation.error}`
            }],
            isError: true
          };
        }
        
        // Check file size
        const sizeValidation = await PathValidator.checkFileSize(filePath);
        if (!sizeValidation.valid) {
          return {
            content: [{
              type: 'text',
              text: `❌ ${sizeValidation.error}`
            }],
            isError: true
          };
        }
        
        // Read file with timeout
        const content = await Promise.race([
          fs.readFile(filePath, 'utf8'),
          new Promise<never>((_, reject) => 
            setTimeout(() => reject(new Error('Read timeout (30s)')), 30000)
          )
        ]);
        
        const duration = Date.now() - startTime;
        const stats = await fs.stat(filePath);
        
        return {
          content: [{
            type: 'text',
            text: content
          }],
          metadata: {
            duration_ms: duration,
            file_size: stats.size,
            file_path: path.resolve(filePath),
            message: `✅ Read ${stats.size} bytes in ${duration}ms`
          }
        };
        
      } catch (error: any) {
        return {
          content: [{
            type: 'text',
            text: `❌ Failed to read file: ${error.message}`
          }],
          isError: true
        };
      }
    }
  • Tool schema definition for faf_read: defines the tool name, description, and input schema requiring a single 'path' string parameter.
    export const fafReadTool: Tool = {
      name: 'faf_read',
      description: 'Read content from any file on the local filesystem',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Absolute or relative file path to read'
          }
        },
        required: ['path']
      }
    };
  • TypeScript interface FafReadArgs defining the typed arguments for faf_read with a required 'path' field.
    export interface FafReadArgs {
      path: string;
    }
  • Routing in FafToolHandler that dispatches 'faf_read' to the fileHandlers.faf_read (handleFafRead) function.
    case 'faf_read':
      return await fileHandlers.faf_read(args);
  • Visibility metadata for faf_read: classified as an 'advanced' tool in the 'file' category.
    faf_read: {
      name: 'faf_read',
      visibility: 'advanced',
      category: 'file',
      description: 'Read .faf file contents',
    },
Behavior2/5

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

No annotations are provided, so the description bears full responsibility for behavioral disclosure. It does not mention read-only nature, permissions, file size limits, or return format. This leaves significant ambiguity for the agent.

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

Conciseness3/5

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

The description is a single short sentence, which is concise but sacrifices necessary detail. It is front-loaded but incomplete.

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

Completeness2/5

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

Given the absence of an output schema and annotations, the description should cover output format, error handling, and scope limitations. It lacks these, making it incomplete for a minimal viable description.

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

Parameters3/5

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

Schema coverage is 100%, so baseline is 3. The description does not add any additional meaning to the 'path' parameter beyond what the schema already provides.

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?

The description clearly states the tool reads content from files on the local filesystem. It uses a specific verb ('Read') and resource ('content from any file'), and distinguishes from siblings like faf_write.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives like faf_list or faf_enhance. The description offers no context about appropriate use cases or exclusions.

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/Wolfe-Jam/grok-faf-mcp'

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