Skip to main content
Glama
GILSMON

MCP Policy Gatekeeper

by GILSMON

read_file

Read file contents to verify compliance with organizational policies before AI coding agents access them, preventing security and naming convention violations.

Instructions

Read contents of a file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path

Implementation Reference

  • The handler for the 'read_file' tool. Resolves the path using resolve_path, checks if the file exists, reads the content if it does, and returns it wrapped in TextContent. Errors if not found.
    elif name == "read_file":
        path = resolve_path(arguments["path"])
        if not path.exists():
            return [TextContent(type="text", text=f"Error: File '{arguments['path']}' not found")]
        
        with open(path, 'r', encoding='utf-8') as f:
            content = f.read()
        return [TextContent(type="text", text=content)]
  • Input schema definition for the 'read_file' tool, specifying an object with a required 'path' string property.
    inputSchema={
        "type": "object",
        "properties": {
            "path": {"type": "string", "description": "File path"}
        },
        "required": ["path"]
    }
  • server.py:89-99 (registration)
    Registration of the 'read_file' tool in the list_tools() function, including name, description, and input schema.
    Tool(
        name="read_file",
        description="Read contents of a file",
        inputSchema={
            "type": "object",
            "properties": {
                "path": {"type": "string", "description": "File path"}
            },
            "required": ["path"]
        }
    ),
Behavior2/5

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

No annotations are provided, so the description carries full burden. While 'Read' implies a non-destructive operation, it doesn't disclose important behavioral traits like file format handling, encoding issues, maximum file size limits, permission requirements, or error conditions for missing files.

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?

The description is perfectly concise at 4 words, front-loaded with the core action, and contains zero wasted words. Every element ('Read', 'contents', 'of a file') contributes essential meaning.

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?

For a file reading tool with no annotations and no output schema, the description is insufficient. It doesn't explain what gets returned (text content, binary data, encoding), error handling, or constraints. Given the complexity of file operations and lack of structured information, more context is needed.

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 description coverage is 100%, so the schema already documents the single 'path' parameter. The description adds no additional meaning about the path parameter beyond what the schema provides, such as path format examples or relative/absolute path handling.

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

Purpose4/5

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

The description clearly states the verb ('Read') and resource ('contents of a file'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_files' which also reads information about files but doesn't read their contents.

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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'list_files' (for metadata) and 'write_file' (for modification), there's no indication of when reading file contents is appropriate versus other file operations.

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/GILSMON/mcpServer_as_gatekeeper'

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