Skip to content

list_files

Use list_files before editing when you need the current model tree or a path prefix. Follow with read_file for content or commit_files for coordinated edits.

read-only · idempotent

NameTypeRequiredDefaultDescription
model_nameAnnotated[str, Field(description='Name of the Bridge Town model.')]Yes
pathAnnotated[str, Field(description="Optional subtree path to list or search within (e.g. 'model'). A single harmless trailing slash (e.g. 'model/') is stripped automatically. Omit to cover all files.")]No''
branch`Annotated[strNone, Field(description=“Branch to operate on. Defaults to the model’s default branch when omitted or null.”)]`NoNone
max_resultsAnnotated[int, Field(description='Listing mode only. Maximum number of files to return. Defaults to 1000. Results are truncated when the total exceeds this.')]No100
patternAnnotated[str, Field(description="Optional glob pattern to filter filenames (e.g. '*.py', 'model/**/*.py'). Applied after path filtering, in both listing and content-search (query) mode.")]No''
queryAnnotated[str, Field(description='Optional text or regex to search file *contents* for. Setting this switches list_files from directory listing to grep-style content search — matches/files_scanned/files_with_matches/skipped_files/files_truncated are returned instead of files/count/total_count/truncated (formerly the standalone search_model_files tool). A literal, case-insensitive substring by default; set regex=True to treat it as a Python regular expression, and case_sensitive=True for case-sensitive matching either way.')]No''
context_linesAnnotated[int, Field(description=f'Query mode only. Lines of context to include before/after each match. Defaults to {_SEARCH_DEFAULT_CONTEXT_LINES}, max {_SEARCH_MAX_CONTEXT_LINES}.')]No2
max_matchesAnnotated[int, Field(description=f'Query mode only. Maximum number of matches to return across all files. Defaults to {_SEARCH_DEFAULT_MAX_MATCHES}, max {_SEARCH_MAX_MATCHES_CAP}.')]No200
max_filesAnnotated[int, Field(description=f'Query mode only. Maximum number of files to scan. Defaults to {_SEARCH_DEFAULT_MAX_FILES}, max {_SEARCH_MAX_FILES_CAP}.')]No200
regexAnnotated[bool, Field(description='Query mode only. Treat query as a Python regular expression. Defaults to False.')]NoFalse
case_sensitiveAnnotated[bool, Field(description='Query mode only. Case-sensitive matching. Defaults to False.')]NoFalse
workspace_id`Annotated[strNone, Field(description=WORKSPACE_ID_FIELD_DESCRIPTION)]`NoNone

Returns a structured object. Top-level fields:

  • model (string)
  • path (string)
  • branch (null)
  • files (array<object>)
  • count (integer)
  • total_count (integer)
  • truncated (boolean)

See the response example below for the full payload shape.

{
"name": "list_files",
"arguments": {
"model_name": "forecasts",
"path": "model",
"pattern": "*.py",
"max_results": 50
}
}
{
"model": "forecasts",
"path": "model",
"branch": null,
"files": [
{
"name": "revenue.py",
"path": "model/revenue.py",
"size": 482,
"type": "file"
},
{
"name": "headcount.py",
"path": "model/headcount.py",
"size": 612,
"type": "file"
}
],
"count": 2,
"total_count": 2,
"truncated": false
}
  • Module: Files
  • Requires authentication via API token or Auth0 JWT.