Skip to main content
Glama

Get project tree

get_tree
Read-onlyIdempotent

Return a filtered project tree without contents to find files by name, path, or glob patterns.

Instructions

Returns filtered structure without contents. Use it to find files by name; use analyze instead for size and token metrics, or pack_context for multi-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 the project root; git_scope and filters only narrow. Project: unique listed name, absolute path returned by list_projects, or #index.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsNoNarrows selection to literal paths for existing project-relative files or directories; glob characters are ordinary.
branchNoRemote Git branch; invalid for local projects.
formatNoSelects the tree representation; markdown is the compact default.markdown
projectNounique listed name, absolute path returned by list_projects, or #index.
git_scopeNoNarrows to staged, changed (including untracked files), or diff:<ref>..<ref> paths; content stays from the current working tree.
max_depthNoLimits levels below the project root without descending below a paths entry; omit it for the deepest complete tree that fits.
tracked_onlyNoRestricts results to Git-tracked files; accepts a boolean or its string form.
max_file_bytesNoExcludes selected files larger than this byte count; accepts an integer or numeric string.
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. 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."
  2. First observedv5.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive/closed-world, so the safety profile is covered. The description adds genuinely useful behavior: results are structure without file contents, output is capped at 2,000 lines and 50,000 characters, and git_scope/filters only narrow rather than expand. It does not say what happens when the cap is hit (truncation vs error), which keeps it below 5.

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?

Front-loads the purpose and the alternative routing in the first sentence, then packs format, limits, and parameter semantics into tight clauses. It is dense and semicolon-heavy, but every clause carries information; nothing is redundant with the name or title.

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?

With no output schema, the description compensates by naming the four return formats and the size envelope. All 10 parameters are documented in the schema, and the description clarifies the two most easily confused selection mechanisms. Only the over-limit behavior is left unstated.

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 the baseline is 3, but the description goes beyond the schema: it contrasts literal `paths` against glob-based `include_patterns` with a concrete brace/glob example, explains that max_depth counts levels below the project root, and notes branch/scope filters only narrow. That is real added meaning over the field 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?

States a specific verb and resource ('Returns filtered structure without contents') and immediately scopes it against siblings by naming analyze for metrics and pack_context for multi-file content. An agent can distinguish get_tree from the other read tools without opening any 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?

Gives an explicit use case ('find files by name') plus two named alternatives with the conditions that select them (size/token metrics, multi-file content). This is the routing information an agent needs to pick the right sibling.

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