Skip to main content
Glama
Project Scope MCP Server

Project Scope MCP Server

validate_file_path

Validates user-provided file paths to prevent path traversal and local file inclusion by detecting ../ sequences, encoding tricks, and null bytes while ensuring containment within the project root.

Instructions

Prevent path traversal (LFI). Detects ../ sequences, URL/double encoding, null bytes, and ensures paths stay within projectRoot. Use when processing user-provided file paths to prevent unauthorized file access.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "filePath": "<filePath>"
    },
    "name": "validate_file_path"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNoValidation mode (default: strict)
filePathYesThe file path to validate
projectRootNoProject root directory to check containment against
sensitivityNoDetection sensitivity (default: high)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.9/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It usefully enumerates the detection categories and the containment rule, but never says what a call returns (boolean, error, sanitized path), what happens on failure, or whether the check is purely read-only with no side effects. That leaves meaningful behavioral gaps for a security gate.

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?

Two sentences, zero filler, with the threat model front-loaded before the usage cue. Nothing is redundant or padded.

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

Completeness3/5

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

There is no output schema, so the description should explain the return contract for a validator that gates file access, and it does not. Given four parameters with full schema coverage, the input side is complete, but the outcome side is left to inference.

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% and both enums (mode, sensitivity) plus their defaults are documented in the schema. The description only echoes projectRoot containment, adding no syntax or semantics beyond the structured fields, so the baseline of 3 applies.

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?

States a specific verb and resource: it detects path traversal patterns (../ sequences, URL/double encoding, null bytes) and enforces containment within projectRoot. The resource (file paths) is distinct enough from the sibling validators (validate_shell_input, validate_sql_query) that an agent can route correctly.

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

Usage Guidelines4/5

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

Gives a clear when-to-use trigger: "processing user-provided file paths to prevent unauthorized file access." It does not name any sibling alternative or state when-not to use it, which keeps it short of a 5.

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