Skip to main content
Glama

Get project tree

get_tree
Read-onlyIdempotent

Returns a filtered project tree without file contents, so you can locate files and directories by name or glob pattern; use get_file instead when you need content.

Instructions

Returns filtered structure without contents. Use it to find files by name; use get_file instead for file content. Returns Markdown/text/JSON/XML within 2,000 lines and 50,000 characters. paths selects literal locations; include_patterns selects names or directories in one call, e.g. include_patterns=["src/middleware/{powered-by,body-limit,bearer-auth}/**/handler.ts"]. format=markdown|text|json|xml; max_depth=0..1000 counts levels below each paths entry, or the project root without paths; filters only narrow.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_tree"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathsNoNarrows selection to literal paths for existing project-relative files or directories; glob characters are ordinary.
formatNoSelects the tree representation; markdown is the compact default.markdown
max_depthNoLimits levels below each requested paths entry, or below the project root when paths is omitted; omit it for the deepest complete tree that fits.
exclude_patternsNoRemoves paths with the same project-relative glob syntax as include_patterns.
include_patternsNoNarrows with project-relative '/' globs: '*' and '?' stay in one segment, '**/' spans depths, and '{a,b}' alternates; matching is case-sensitive, while '!' and '[...]' are rejected.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv5.2.5
    • removedInput schema / properties / branch
      Removed value: -{
      -  "description": "Remote Git branch; invalid for local projects.",
      -  "minLength": 1,
      -  "type": "string"
      -}
    • changedInput schema / properties / exclude_patterns / oneOf
      Previous value: -[
      -  {
      -    "maxLength": 512,
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "items": {
      -      "maxLength": 512,
      -      "minLength": 1,
      -      "type": "string"
      -    },
      -    "maxItems": 256,
      -    "type": "array"
      -  }
      -]New value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  }
      +]
    • removedInput schema / properties / git_scope
      Removed value: -{
      -  "description": "Narrows to staged, changed (including untracked files), or diff:<ref>..<ref> paths; content stays from the current working tree.",
      -  "maxLength": 4096,
      -  "oneOf": [
      -    {
      -      "enum": [
      -        "staged",
      -        "changes"
      -      ],
      -      "type": "string"
      -    },
      -    {
      -      "pattern": "^diff:(?!.*\\.\\.\\.)(?!.*\\.\\..*\\.\\.)[^\\s-]\\S*\\.\\.[^\\s-]\\S*$",
      -      "type": "string"
      -    }
      -  ]
      -}
    • changedInput schema / properties / include_patterns / oneOf
      Previous value: -[
      -  {
      -    "maxLength": 512,
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "items": {
      -      "maxLength": 512,
      -      "minLength": 1,
      -      "type": "string"
      -    },
      -    "maxItems": 256,
      -    "type": "array"
      -  }
      -]New value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  }
      +]
    • changedInput schema / properties / max_depth / description
      Previous value: -"Limits levels below the project root without descending below a paths entry; omit it for the deepest complete tree that fits."New value: +"Limits levels below each requested paths entry, or below the project root when paths is omitted; omit it for the deepest complete tree that fits."
    • changedInput schema / properties / max_depth / oneOf
      Previous value: -[
      -  {
      -    "maximum": 1000,
      -    "minimum": 0,
      -    "type": "integer"
      -  },
      -  {
      -    "pattern": "^[0-9]+$",
      -    "type": "string"
      -  }
      -]New value: +[
      +  {
      +    "maximum": 1000,
      +    "minimum": 0,
      +    "type": "integer"
      +  },
      +  {
      +    "type": "string"
      +  }
      +]
    • removedInput schema / properties / max_file_bytes
      Removed value: -{
      -  "description": "Excludes selected files larger than this byte count; accepts an integer or numeric string.",
      -  "oneOf": [
      -    {
      -      "minimum": 1,
      -      "type": "integer"
      -    },
      -    {
      -      "pattern": "^0*[1-9][0-9]*$",
      -      "type": "string"
      -    }
      -  ]
      -}
    • changedInput schema / properties / paths / oneOf
      Previous value: -[
      -  {
      -    "maxLength": 4096,
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "items": {
      -      "maxLength": 4096,
      -      "minLength": 1,
      -      "type": "string"
      -    },
      -    "maxItems": 256,
      -    "type": "array"
      -  }
      -]New value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  }
      +]
    • removedInput schema / properties / project
      Removed value: -{
      -  "description": "unique listed name, absolute path returned by list_projects, or #index.",
      -  "type": "string"
      -}
    • removedInput schema / properties / tracked_only
      Removed value: -{
      -  "default": false,
      -  "description": "Restricts results to Git-tracked files; accepts a boolean or its string form.",
      -  "oneOf": [
      -    {
      -      "type": "boolean"
      -    },
      -    {
      -      "enum": [
      -        "true",
      -        "false"
      -      ],
      -      "type": "string"
      -    }
      -  ]
      -}
  2. Changed18 schema fields changedv5.2.0
    • changedInput schema / properties / branch / description
      Previous value: -"Optional Git branch for a remote project URL; invalid for local project paths."New value: +"Remote Git branch; invalid for local projects."
    • changedInput schema / properties / exclude_patterns / description
      Previous value: -"Project-relative glob patterns using '/' to exclude additional paths."New value: +"Removes paths with the same project-relative glob syntax as include_patterns."
    • removedInput schema / properties / exclude_patterns / items
      Removed value: -{
      -  "maxLength": 512,
      -  "minLength": 1,
      -  "type": "string"
      -}
    • removedInput schema / properties / exclude_patterns / maxItems
      Removed value: -256
    • addedInput schema / properties / exclude_patterns / oneOf
      Added value: +[
      +  {
      +    "maxLength": 512,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "maxLength": 512,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "maxItems": 256,
      +    "type": "array"
      +  }
      +]
    • removedInput schema / properties / exclude_patterns / type
      Removed value: -"array"
    • changedInput schema / properties / format / description
      Previous value: -"Tree representation. Markdown is the compact default; text uses drawing characters, while JSON and XML are structured."New value: +"Selects the tree representation; markdown is the compact default."
    • changedInput schema / properties / git_scope / description
      Previous value: -"Further restrict results to staged files, all current changes, or files changed between two Git refs."New value: +"Narrows to staged, changed (including untracked files), or diff:<ref>..<ref> paths; content stays from the current working tree."
    • changedInput schema / properties / include_patterns / description
      Previous value: -"Project-relative glob patterns using '/'. They only narrow built-in and gitignore filtering."New value: +"Narrows with project-relative '/' globs: '*' and '?' stay in one segment, '**/' spans depths, and '{a,b}' alternates; matching is case-sensitive, while '!' and '[...]' are rejected."
    • removedInput schema / properties / include_patterns / items
      Removed value: -{
      -  "maxLength": 512,
      -  "minLength": 1,
      -  "type": "string"
      -}
    • removedInput schema / properties / include_patterns / maxItems
      Removed value: -256
    • addedInput schema / properties / include_patterns / oneOf
      Added value: +[
      +  {
      +    "maxLength": 512,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "maxLength": 512,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "maxItems": 256,
      +    "type": "array"
      +  }
      +]
    • removedInput schema / properties / include_patterns / type
      Removed value: -"array"
    • changedInput schema / properties / max_depth / description
      Previous value: -"Maximum tree depth from 0 to 1000; accepts an integer or numeric string."New value: +"Limits levels below the project root without descending below a paths entry; omit it for the deepest complete tree that fits."
    • changedInput schema / properties / max_file_bytes / description
      Previous value: -"Exclude otherwise selected files strictly larger than this byte count; integer or numeric string."New value: +"Excludes selected files larger than this byte count; accepts an integer or numeric string."
    • addedInput schema / properties / paths
      Added value: +{
      +  "description": "Narrows selection to literal paths for existing project-relative files or directories; glob characters are ordinary.",
      +  "oneOf": [
      +    {
      +      "maxLength": 4096,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    {
      +      "items": {
      +        "maxLength": 4096,
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "maxItems": 256,
      +      "type": "array"
      +    }
      +  ]
      +}
    • changedInput schema / properties / project / description
      Previous value: -"Absolute root path returned by list_projects, or a Git URL when the server allows remote sources. Optional only when one local root is configured."New value: +"unique listed name, absolute path returned by list_projects, or #index."
    • changedInput schema / properties / tracked_only / description
      Previous value: -"Restrict results to files tracked by Git; accepts a boolean or the string 'true' or 'false'."New value: +"Restricts results to Git-tracked files; accepts a boolean or its string form."
  3. First observedv5.1.0

TDQS

A4.4/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, closed-world and non-destructive behavior, so the safety profile is covered. The description adds real value with output caps (2,000 lines / 50,000 characters), the selectable representations, and the "filters only narrow" constraint. It does not explain what happens when the cap is exceeded (truncation vs. error), which is the main remaining behavioral unknown.

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

Conciseness4/5

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

It is front-loaded with the purpose and the sibling exclusion, then parameter notes, and nearly every sentence carries decision-relevant information. The long inline glob example is the one verbose element, though it does clarify syntax that would otherwise be abstract.

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

Completeness5/5

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

With no output schema and zero required parameters, the description compensates by describing return formats and size limits, and by covering the two selection mechanisms and their interaction. Nothing essential for a correct first call is missing.

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 description coverage is already 100%, so the baseline is 3; the description earns above that by explaining the interaction between parameters that the schema documents individually — max_depth counts levels below each paths entry, or below the project root when paths is omitted. It also supplies a concrete include_patterns glob example illustrating the brace/`**` syntax.

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 first two sentences state a specific verb and resource ("Returns filtered structure without contents") and immediately distinguish it from the sibling get_file ("use get_file instead for file content"). An agent can pick between them without opening either schema.

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?

It gives explicit routing guidance: use this tool to find files by name, use get_file for content. It also states the selection strategy (paths for literal locations, include_patterns for names or directories in one call) and the rule that filters only narrow, leaving no ambiguity about intent.

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