> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codealive.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get repository file tree

> Returns a bounded directory tree for one repository, with short generated summaries for files and folders. Use it for structural orientation when you need to see how a repository (or one directory) is laid out; bound the response with `max_depth` and `max_nodes`. For concept questions prefer `semantic_search` — a folder whose name matches a concept is one candidate, not the whole story.



## OpenAPI

````yaml /openapi-tool-api-v3.json post /api/tools/get_file_tree
openapi: 3.1.1
info:
  title: CodeAlive Tool API
  description: >-
    Tool-only OpenAPI 3.1 contract for MCP and agent integrations. Every
    operation is read-only and returns a Tool API envelope.
  contact:
    name: CodeAlive Team
    url: https://codealive.ai
    email: support@codealive.ai
  license:
    name: Terms of Service
    url: https://app.codealive.ai/terms
  version: 3.0.0
servers:
  - url: https://app.codealive.ai
security:
  - ApiKeyScheme: []
tags:
  - name: ToolApi
    description: CodeAlive Tool API v3
paths:
  /api/tools/get_file_tree:
    post:
      tags:
        - ToolApi
      summary: Get repository file tree
      description: >-
        Returns a bounded directory tree for one repository, with short
        generated summaries for files and folders. Use it for structural
        orientation when you need to see how a repository (or one directory) is
        laid out; bound the response with `max_depth` and `max_nodes`. For
        concept questions prefer `semantic_search` — a folder whose name matches
        a concept is one candidate, not the whole story.
      operationId: ToolApiGetFileTree
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileTreeToolRequest'
            example:
              data_source: CodeAlive-AI/agent-framework
              max_depth: 3
          text/json:
            schema:
              $ref: '#/components/schemas/FileTreeToolRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/FileTreeToolRequest'
      responses:
        '200':
          description: >-
            Success envelope. obj contains trees[] (one per resolved repository)
            with a rendered tree string and a hint; rendered is the
            JSON-serialized form of obj. Repairable failures (missing or invalid
            arguments, ambiguous or unknown data sources) also return HTTP 200
            with obj.error = { code, message, retry, try } and a rendered
            <tool_error> block; repair the arguments and retry.
          content:
            application/json:
              schema:
                oneOf:
                  - required:
                      - obj
                      - rendered
                    type: object
                    properties:
                      obj:
                        $ref: '#/components/schemas/AgentFileTreeToolResponse'
                      rendered:
                        type: string
                        description: Agent-facing result text.
                    additionalProperties: false
                    description: >-
                      Default success projection returned when output_format is
                      omitted.
                  - required:
                      - obj
                    type: object
                    properties:
                      obj:
                        $ref: '#/components/schemas/AgentFileTreeToolResponse'
                    additionalProperties: false
                    description: >-
                      Structured success projection returned when output_format
                      is json.
                  - required:
                      - rendered
                    type: object
                    properties:
                      rendered:
                        type: string
                        description: Agent-facing result text.
                    additionalProperties: false
                    description: >-
                      Agent-facing success projection returned when
                      output_format is agentic.
                  - required:
                      - obj
                      - rendered
                    type: object
                    properties:
                      obj:
                        $ref: '#/components/schemas/ToolApiRepairableResult'
                      rendered:
                        type: string
                        description: Agent-facing result text.
                    additionalProperties: false
                    description: >-
                      Repairable failure. Always includes both projections and
                      uses HTTP 200.
              examples:
                default:
                  summary: Default success response
                  description: >-
                    Returned when output_format is omitted; includes both
                    projections.
                  value:
                    obj:
                      trees:
                        - dataSource:
                            type: Repository
                            name: agent-framework
                          fullName: CodeAlive-AI/agent-framework
                          path: .
                          found: true
                          tree: |-
                            src/ — core packages
                              executor.py — task execution loop
                              scheduler.py — queue draining
                            tests/ — pytest suite
                      hint: Use read_file or fetch_artifacts to open specific files.
                    rendered: >-
                      {"trees":[{"dataSource":{"type":"Repository","name":"agent-framework"},"fullName":"CodeAlive-AI/agent-framework","path":".","found":true,"tree":"src/
                      — core packages\n  executor.py — task execution loop\n 
                      scheduler.py — queue draining\ntests/ — pytest
                      suite"}],"hint":"Use read_file or fetch_artifacts to open
                      specific files."}
                json_only:
                  summary: JSON success response
                  description: Returned when output_format is json.
                  value:
                    obj:
                      trees:
                        - dataSource:
                            type: Repository
                            name: agent-framework
                          fullName: CodeAlive-AI/agent-framework
                          path: .
                          found: true
                          tree: |-
                            src/ — core packages
                              executor.py — task execution loop
                              scheduler.py — queue draining
                            tests/ — pytest suite
                      hint: Use read_file or fetch_artifacts to open specific files.
                agentic_only:
                  summary: Agent-facing success response
                  description: Returned when output_format is agentic.
                  value:
                    rendered: >-
                      {"trees":[{"dataSource":{"type":"Repository","name":"agent-framework"},"fullName":"CodeAlive-AI/agent-framework","path":".","found":true,"tree":"src/
                      — core packages\n  executor.py — task execution loop\n 
                      scheduler.py — queue draining\ntests/ — pytest
                      suite"}],"hint":"Use read_file or fetch_artifacts to open
                      specific files."}
                repairable_error:
                  summary: Repairable tool error
                  description: >-
                    Returned with HTTP 200 when arguments can be corrected and
                    retried.
                  value:
                    obj:
                      error:
                        code: unknown_argument
                        message: >-
                          Unknown JSON argument(s) are not accepted in Tool API
                          v3: search_mode.
                        retry: >-
                          yes - repair the tool arguments and call the tool
                          again
                        try: >-
                          Use only the canonical arguments documented for this
                          tool.
                    rendered: |
                      <tool_error>
                        <code>unknown_argument</code>
                        <message>Unknown JSON argument(s) are not accepted in Tool API v3: search_mode.</message>
                        <retry>yes - repair the tool arguments and call the tool again</retry>
                        <try>Use only the canonical arguments documented for this tool.</try>
                      </tool_error>
            text/json:
              schema:
                $ref: '#/components/schemas/ToolApiEnvelope'
        '400':
          description: >-
            Bad request, including malformed JSON, unknown output_format, or
            invalid transport-level input.
        '401':
          description: Authentication failed or API key is missing.
        '403':
          description: >-
            The caller is not authorized for the requested data source or plan
            feature.
        '429':
          description: Rate limit, quota, or plan limit exceeded.
        '500':
          description: Unexpected server failure.
components:
  schemas:
    FileTreeToolRequest:
      type: object
      properties:
        output_format:
          enum:
            - json
            - agentic
          type:
            - 'null'
            - string
          description: >-
            Optional success projection. Omit to return both obj and rendered;
            use json for obj only; use agentic for rendered text only.
            Repairable errors always return both obj.error and rendered.
        data_source:
          type:
            - 'null'
            - string
          description: >-
            One repository name or id returned by get_data_sources. Required
            when more than one repository is visible.
        path:
          type:
            - 'null'
            - string
          description: >-
            Optional repository-relative directory path. Omit for repository
            root.
        max_depth:
          type:
            - 'null'
            - integer
          description: Optional traversal depth limit.
          format: int32
        max_nodes:
          type:
            - 'null'
            - integer
          description: Optional maximum number of tree nodes to return.
          format: int32
        output_depth:
          type:
            - 'null'
            - integer
          description: Optional rendered output depth limit.
          format: int32
      additionalProperties: false
    AgentFileTreeToolResponse:
      required:
        - hint
      type: object
      properties:
        trees:
          type:
            - 'null'
            - array
          items:
            $ref: '#/components/schemas/AgentFileTreeItem'
          description: One tree for the resolved repository.
        hint:
          type:
            - 'null'
            - string
          description: Suggested next tool call.
        error:
          $ref: '#/components/schemas/AgentToolError'
          description: Recoverable file-tree error, when applicable.
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/ToolApiWarning'
          description: >-
            Compatibility warnings, such as accepted deprecated argument
            aliases.
      additionalProperties: false
    ToolApiRepairableResult:
      required:
        - error
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ToolApiRepairableError'
          description: Structured error details used to repair the request and retry.
        warnings:
          type:
            - 'null'
            - array
          items:
            $ref: '#/components/schemas/ToolApiWarning'
          description: Compatibility warnings emitted before the request failed.
      additionalProperties: false
      description: >-
        Repairable failure returned with HTTP 200 so an agent can correct the
        request and retry.
    ToolApiEnvelope:
      type: object
      properties:
        obj:
          description: >-
            Arbitrary JSON result for the tool. Present for omitted/json success
            projections and every repairable error.
        rendered:
          type:
            - 'null'
            - string
          description: >-
            Agent-facing result text. Present for omitted/agentic success
            projections and every repairable error.
      additionalProperties: false
    AgentFileTreeItem:
      type: object
      properties:
        dataSource:
          $ref: '#/components/schemas/AgentToolDataSourceRef'
          description: Resolved repository reference.
        fullName:
          type:
            - 'null'
            - string
          description: Owner-qualified repository name.
        path:
          type:
            - 'null'
            - string
          description: Repository-relative tree root.
        found:
          type: boolean
          description: Whether the requested path exists.
        tree:
          type:
            - 'null'
            - string
          description: Rendered bounded directory tree.
      additionalProperties: false
    AgentToolError:
      type: object
      properties:
        tool:
          type:
            - 'null'
            - string
          description: Tool whose request could not be completed.
        detail:
          type:
            - 'null'
            - string
          description: Human-readable explanation of the failure.
        retry:
          type:
            - 'null'
            - string
          description: Whether the caller should repair the request and retry.
        hint:
          type:
            - 'null'
            - string
          description: Concrete guidance for repairing the next request.
      additionalProperties: false
    ToolApiWarning:
      type: object
      properties:
        code:
          type:
            - 'null'
            - string
          description: Stable machine-readable warning code.
        message:
          type:
            - 'null'
            - string
          description: Human-readable compatibility warning.
        alias:
          type:
            - 'null'
            - string
          description: Deprecated argument alias that was accepted.
        canonical:
          type:
            - 'null'
            - string
          description: Canonical argument name to use instead of the alias.
      additionalProperties: false
    ToolApiRepairableError:
      type: object
      properties:
        code:
          type:
            - 'null'
            - string
          description: Stable machine-readable error code.
        message:
          type:
            - 'null'
            - string
          description: Human-readable explanation of the invalid request.
        retry:
          type:
            - 'null'
            - string
          description: Whether the caller should correct the request and retry.
        try:
          type:
            - 'null'
            - string
          description: Concrete guidance for repairing the next request.
      additionalProperties: false
    AgentToolDataSourceRef:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
          description: Repository or Workspace.
        name:
          type:
            - 'null'
            - string
          description: Data-source display name.
      additionalProperties: false
  securitySchemes:
    ApiKeyScheme:
      type: http
      description: >-
        API Key authentication using Bearer token. Example: "Authorization:
        Bearer {apiKey}"
      scheme: bearer
      bearerFormat: API Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.