> ## 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 ontology

> Returns the generated high-level map (ontology) of one repository: its purpose, subsystems, key concepts, and how they relate. Use it to orient before focused searching when the repository is unfamiliar, or to decide which part of a large codebase a question lands in. Accepts exactly one repository — workspace names are rejected; pick a specific repository from `get_data_sources`.



## OpenAPI

````yaml /openapi-tool-api-v3.json post /api/tools/get_repository_ontology
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_repository_ontology:
    post:
      tags:
        - ToolApi
      summary: Get repository ontology
      description: >-
        Returns the generated high-level map (ontology) of one repository: its
        purpose, subsystems, key concepts, and how they relate. Use it to orient
        before focused searching when the repository is unfamiliar, or to decide
        which part of a large codebase a question lands in. Accepts exactly one
        repository — workspace names are rejected; pick a specific repository
        from `get_data_sources`.
      operationId: ToolApiGetRepositoryOntology
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RepositoryToolRequest'
            example:
              data_source: CodeAlive-AI/agent-framework
          text/json:
            schema:
              $ref: '#/components/schemas/RepositoryToolRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/RepositoryToolRequest'
      responses:
        '200':
          description: >-
            Success envelope. obj is { repository_count, content } where content
            is the ontology Markdown; rendered is the same Markdown text.
            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:
                $ref: '#/components/schemas/ToolApiEnvelope'
              example:
                obj:
                  repository_count: 1
                  content: |
                    # agent-framework

                    ## Subsystems
                    - Task execution — scheduling, retries, telemetry.
                    - Transport — message bus adapters.
                rendered: |
                  # agent-framework

                  ## Subsystems
                  - Task execution — scheduling, retries, telemetry.
                  - Transport — message bus adapters.
            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:
    RepositoryToolRequest:
      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.
      additionalProperties: false
    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
  securitySchemes:
    ApiKeyScheme:
      type: http
      description: >-
        API Key authentication using Bearer token. Example: "Authorization:
        Bearer {apiKey}"
      scheme: bearer
      bearerFormat: API Key

````