component_tree
Traverse project directories, files, and modules to explore SonarCloud structure. Filter by qualifiers, search names, and use branch or PR context to find specific components.
Instructions
Traverse modules/files inside a project; supports paging, qualifier filters, and branch/PR context.
Returns a hierarchical view of project components (directories, files, modules). Use this to explore project structure or find specific files.
Example: component_tree(component="my-project", qualifiers=["FIL"], q="test", branch="main")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| p | No | Page number (1-indexed) | |
| q | No | Search query to filter component names (case-insensitive) | |
| ps | No | Page size (max 500) | |
| asc | No | Sort ascending (true) or descending (false). Defaults to true | |
| branch | No | Branch name (e.g., 'main') | |
| strategy | No | Tree traversal strategy. Valid values: 'all' (default), 'children' (direct children only), 'leaves' (files only) | |
| component | Yes | Project key to traverse (e.g., 'my-project') | |
| qualifiers | No | Filter by component qualifiers. Valid values: 'BRC' (branch), 'DIR' (directory), 'FIL' (file), 'TRK' (project), 'UTS' (test file). Example: ['FIL', 'DIR'] | |
| pullRequest | No | Pull request ID (e.g., '123') | |
| sort_fields | No | Fields to sort by. Valid values: 'name', 'path', 'qualifier'. Example: ['name', 'path'] |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||