Skip to main content
Glama

Analyze project

analyze
Read-onlyIdempotent

Measures token estimates, document size, and largest files for a code selection before packaging, helping you choose pack_context filters or max_tokens.

Instructions

Measures a selection before packaging: protected metrics, estimates, document size, and largest files. Use it to choose pack_context filters or max_tokens; use get_tree for structure and pack_context for content. Returns measured and estimated metrics without file bodies. Key parameters: detail=full|compact|signatures, top_files, git_scope, paths, include_patterns, exclude_patterns, profile, and max_file_bytes. Last detail_by_pattern match wins. max_tokens reports pack_context's greedy admission; rank and focus require it. Project: unique listed name, absolute path returned by list_projects, or #index.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rankNoOrders the selection with importance-v1 and controls max_tokens admission; omission keeps ordinary order and avoids dependency or Git-history work.
focusNoSeeds focus-v1 order from 1..16 selected paths; requires rank=importance and never widens selection.
pathsNoNarrows selection to literal paths for existing project-relative files or directories; glob characters are ordinary.
branchNoRemote Git branch; invalid for local projects.
detailNoContent transform: full adds no transformations; transformations enabled by the active profile still apply. Compact removes comments and blank lines, and signatures keeps supported code signatures; other languages remain unchanged.full
profileNoSelection profile: standard uses all eight exclusion toggles plus gitignore; local uses the desktop profile listed by list_projects.profiles; otherwise give a portable profile path inside the project.
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.
top_filesNoReturns this many largest text files by estimated tokens.
max_tokensNoSets greedy content admission; document structure and its report are outside this heuristic token budget.
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.
detail_by_patternNoOverrides detail by file in array order; the last match wins, never widens selection, and unmatched or invalid entries are reported.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed28 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 / detail / description
      Previous value: -"Collapse code to signatures or strip comments/blank lines to fit large projects into a budget; unsupported languages are returned unchanged."New value: +"Content transform: full adds no transformations; transformations enabled by the active profile still apply. Compact removes comments and blank lines, and signatures keeps supported code signatures; other languages remain unchanged."
    • addedInput schema / properties / detail_by_pattern
      Added value: +{
      +  "description": "Overrides detail by file in array order; the last match wins, never widens selection, and unmatched or invalid entries are reported.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "detail": {
      +        "enum": [
      +          "full",
      +          "compact",
      +          "signatures"
      +        ],
      +        "type": "string"
      +      },
      +      "patterns": {
      +        "description": "Uses the include_patterns glob syntax.",
      +        "items": {
      +          "maxLength": 512,
      +          "minLength": 1,
      +          "type": "string"
      +        },
      +        "maxItems": 32,
      +        "minItems": 1,
      +        "type": "array"
      +      }
      +    },
      +    "required": [
      +      "patterns",
      +      "detail"
      +    ],
      +    "type": "object"
      +  },
      +  "maxItems": 16,
      +  "type": "array"
      +}
    • 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"
    • addedInput schema / properties / focus
      Added value: +{
      +  "description": "Seeds focus-v1 order from 1..16 selected paths; requires rank=importance and never widens selection.",
      +  "oneOf": [
      +    {
      +      "maxLength": 4096,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    {
      +      "items": {
      +        "maxLength": 4096,
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "maxItems": 16,
      +      "minItems": 1,
      +      "type": "array"
      +    }
      +  ]
      +}
    • 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_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 / max_tokens
      Added value: +{
      +  "description": "Sets greedy content admission; document structure and its report are outside this heuristic token budget.",
      +  "oneOf": [
      +    {
      +      "minimum": 1,
      +      "type": "integer"
      +    },
      +    {
      +      "pattern": "^0*[1-9][0-9]*$",
      +      "type": "string"
      +    }
      +  ]
      +}
    • changedInput schema / properties / paths / description
      Previous value: -"Existing project-relative files or directories that narrow the selection."New value: +"Narrows selection to literal paths for existing project-relative files or directories; glob characters are ordinary."
    • removedInput schema / properties / paths / items
      Removed value: -{
      -  "maxLength": 4096,
      -  "minLength": 1,
      -  "type": "string"
      -}
    • removedInput schema / properties / paths / maxItems
      Removed value: -256
    • addedInput schema / properties / paths / oneOf
      Added value: +[
      +  {
      +    "maxLength": 4096,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "maxLength": 4096,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "maxItems": 256,
      +    "type": "array"
      +  }
      +]
    • removedInput schema / properties / paths / type
      Removed value: -"array"
    • changedInput schema / properties / profile / description
      Previous value: -"Selection profile: 'standard', 'local', or a portable profile JSON path inside the project root."New value: +"Selection profile: standard uses all eight exclusion toggles plus gitignore; local uses the desktop profile listed by list_projects.profiles; otherwise give a portable profile path inside the project."
    • 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."
    • addedInput schema / properties / rank
      Added value: +{
      +  "description": "Orders the selection with importance-v1 and controls max_tokens admission; omission keeps ordinary order and avoids dependency or Git-history work.",
      +  "enum": [
      +    "importance"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / top_files / description
      Previous value: -"Number of largest text files to return by estimated tokens; default 10; integer or numeric string."New value: +"Returns this many largest text files by estimated tokens."
    • 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."
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": false,
      -  "properties": {
      -    "characters": {
      -      "type": "integer"
      -    },
      -    "detail": {
      -      "enum": [
      -        "full",
      -        "compact",
      -        "signatures"
      -      ],
      -      "type": "string"
      -    },
      -    "files": {
      -      "type": "integer"
      -    },
      -    "tokens": {
      -      "type": "integer"
      -    },
      -    "topFiles": {
      -      "items": {
      -        "additionalProperties": false,
      -        "properties": {
      -          "path": {
      -            "type": "string"
      -          },
      -          "tokens": {
      -            "type": "integer"
      -          }
      -        },
      -        "required": [
      -          "path",
      -          "tokens"
      -        ],
      -        "type": "object"
      -      },
      -      "type": "array"
      -    }
      -  },
      -  "required": [
      -    "files",
      -    "characters",
      -    "tokens",
      -    "detail",
      -    "topFiles"
      -  ],
      -  "type": "object"
      -}New value: +null
  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 readOnlyHint/idempotentHint/non-destructive/closed-world, so safety is covered. The description still adds non-obvious behavior beyond the schema: it is a measurement pass that 'Returns measured and estimated metrics without file bodies,' and it discloses the rank/focus dependency on max_tokens. No auth, rate-limit, or error behavior is mentioned, keeping it short of a 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-loaded with purpose, then routing, then return behavior, then parameter notes. The mid-sentence enumeration of key parameter names is somewhat redundant given full schema coverage, but overall it is dense and mostly earns its space.

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?

For a 15-parameter, zero-required tool with no output schema, the description covers purpose, routing, return shape, and key parameter interactions adequately. It does not explain the shape of the returned metric report in detail, but annotations and the schema carry the remaining load.

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 adds genuine cross-parameter semantics the schema cannot express: 'Last detail_by_pattern match wins' and 'max_tokens reports pack_context's greedy admission; rank and focus require it.' That interaction guidance raises it above baseline.

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 opening sentence gives a specific verb ('Measures') and enumerates the concrete outputs (protected metrics, estimates, document size, largest files), and it explicitly positions the tool against siblings get_tree and pack_context. An agent can tell what it does and how it differs from neighbors without opening a 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?

'Use it to choose pack_context filters or max_tokens; use get_tree for structure and pack_context for content' names the alternatives and the exact condition that selects each. This is explicit when-to-use routing rather than implied context.

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