> ## 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 artifact relationships

> Traverses the code graph around one known artifact: callers, callees, inheritance, and references. Choose `profile` by the question: `calls_only` (default) for call edges of functions and methods, `inheritance_only` for base types and implementations, `references_only` for where-used checks on types, fields, events, and other non-call usage, `all_relevant` for calls plus inheritance. Use it to find upstream entry points and downstream consumers before reading more files.



## OpenAPI

````yaml /openapi-tool-api-v3.json post /api/tools/get_artifact_relationships
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_artifact_relationships:
    post:
      tags:
        - ToolApi
      summary: Get artifact relationships
      description: >-
        Traverses the code graph around one known artifact: callers, callees,
        inheritance, and references. Choose `profile` by the question:
        `calls_only` (default) for call edges of functions and methods,
        `inheritance_only` for base types and implementations, `references_only`
        for where-used checks on types, fields, events, and other non-call
        usage, `all_relevant` for calls plus inheritance. Use it to find
        upstream entry points and downstream consumers before reading more
        files.
      operationId: ToolApiGetArtifactRelationships
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ArtifactRelationshipsToolRequest'
            example:
              identifier: CodeAlive-AI/agent-framework::src/foo.py::Foo.run
              profile: calls_only
          text/json:
            schema:
              $ref: '#/components/schemas/ArtifactRelationshipsToolRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/ArtifactRelationshipsToolRequest'
      responses:
        '200':
          description: >-
            Success envelope. obj describes the traversal: sourceIdentifier,
            profile, found, relationships[] grouped by relationType with items[]
            (identifier, filePath, startLine, shortSummary) and truncation
            flags, plus availableRelationshipCounts; 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/ArtifactRelationshipsResponse'
                      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/ArtifactRelationshipsResponse'
                    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:
                      sourceIdentifier: >-
                        CodeAlive-AI/agent-framework::src/executor.py::TaskExecutor.run
                      profile: CallsOnly
                      found: true
                      relationships:
                        - relationType: IncomingCalls
                          totalCount: 2
                          returnedCount: 2
                          truncated: false
                          items:
                            - identifier: >-
                                CodeAlive-AI/agent-framework::src/scheduler.py::Scheduler.tick
                              filePath: src/scheduler.py
                              startLine: 17
                              shortSummary: Drains the queue and dispatches due tasks.
                      availableRelationshipCounts:
                        outgoingCalls: 3
                        incomingCalls: 2
                        ancestors: 0
                        descendants: 0
                        references: 5
                    rendered: >-
                      {"sourceIdentifier":"CodeAlive-AI/agent-framework::src/executor.py::TaskExecutor.run","profile":"CallsOnly","found":true,"relationships":[{"relationType":"IncomingCalls","totalCount":2,"items":[{"identifier":"CodeAlive-AI/agent-framework::src/scheduler.py::Scheduler.tick","filePath":"src/scheduler.py","startLine":17}]}]}
                json_only:
                  summary: JSON success response
                  description: Returned when output_format is json.
                  value:
                    obj:
                      sourceIdentifier: >-
                        CodeAlive-AI/agent-framework::src/executor.py::TaskExecutor.run
                      profile: CallsOnly
                      found: true
                      relationships:
                        - relationType: IncomingCalls
                          totalCount: 2
                          returnedCount: 2
                          truncated: false
                          items:
                            - identifier: >-
                                CodeAlive-AI/agent-framework::src/scheduler.py::Scheduler.tick
                              filePath: src/scheduler.py
                              startLine: 17
                              shortSummary: Drains the queue and dispatches due tasks.
                      availableRelationshipCounts:
                        outgoingCalls: 3
                        incomingCalls: 2
                        ancestors: 0
                        descendants: 0
                        references: 5
                agentic_only:
                  summary: Agent-facing success response
                  description: Returned when output_format is agentic.
                  value:
                    rendered: >-
                      {"sourceIdentifier":"CodeAlive-AI/agent-framework::src/executor.py::TaskExecutor.run","profile":"CallsOnly","found":true,"relationships":[{"relationType":"IncomingCalls","totalCount":2,"items":[{"identifier":"CodeAlive-AI/agent-framework::src/scheduler.py::Scheduler.tick","filePath":"src/scheduler.py","startLine":17}]}]}
                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:
    ArtifactRelationshipsToolRequest:
      required:
        - identifier
      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.
        identifier:
          type:
            - 'null'
            - string
          description: >-
            Full artifact identifier from a previous search, fetch, or
            relationship result.
        profile:
          enum:
            - calls_only
            - inheritance_only
            - all_relevant
            - references_only
          type:
            - 'null'
            - string
          description: Relationship profile. Default is calls_only.
        max_count_per_type:
          type:
            - 'null'
            - integer
          description: >-
            Maximum relationships to return per relationship type. Default is
            50.
          format: int32
        data_source:
          type:
            - 'null'
            - string
          description: >-
            Optional repository or workspace name/id used to disambiguate the
            identifier.
      additionalProperties: false
    ArtifactRelationshipsResponse:
      required:
        - found
        - profile
        - relationships
        - sourceIdentifier
      type: object
      properties:
        sourceIdentifier:
          type:
            - 'null'
            - string
          description: Requested source artifact identifier.
        profile:
          $ref: '#/components/schemas/ArtifactRelationshipsProfileDto'
          description: Resolved relationship expansion profile.
        found:
          type: boolean
          description: Whether the source artifact resolved.
        relationships:
          type:
            - 'null'
            - array
          items:
            $ref: '#/components/schemas/ArtifactRelationshipGroupDto'
          description: Relationship groups selected by the profile.
        availableRelationshipCounts:
          $ref: '#/components/schemas/ArtifactRelationshipCountsDto'
          description: Accessible counts for every relationship family.
        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
    ArtifactRelationshipsProfileDto:
      enum:
        - CallsOnly
        - InheritanceOnly
        - AllRelevant
        - ReferencesOnly
      type: string
    ArtifactRelationshipGroupDto:
      required:
        - items
        - relationType
        - returnedCount
        - totalCount
        - truncated
      type: object
      properties:
        relationType:
          $ref: '#/components/schemas/ArtifactRelationshipTypeDto'
          description: Relationship family.
        totalCount:
          type: integer
          description: Total accessible related artifacts.
          format: int32
        returnedCount:
          type: integer
          description: Items returned in this group.
          format: int32
        truncated:
          type: boolean
          description: Whether additional items were omitted.
        items:
          type:
            - 'null'
            - array
          items:
            $ref: '#/components/schemas/ArtifactRelationshipItemDto'
          description: Related artifact previews.
      additionalProperties: false
    ArtifactRelationshipCountsDto:
      required:
        - ancestors
        - descendants
        - incomingCalls
        - outgoingCalls
        - references
      type: object
      properties:
        outgoingCalls:
          type: integer
          description: Accessible outgoing-call count.
          format: int32
        incomingCalls:
          type: integer
          description: Accessible incoming-call count.
          format: int32
        ancestors:
          type: integer
          description: Accessible base-type and ancestor count.
          format: int32
        descendants:
          type: integer
          description: Accessible derived-type and implementation count.
          format: int32
        references:
          type: integer
          description: Accessible non-call reference count.
          format: int32
      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
    ArtifactRelationshipTypeDto:
      enum:
        - OutgoingCalls
        - IncomingCalls
        - Ancestors
        - Descendants
        - References
      type: string
    ArtifactRelationshipItemDto:
      required:
        - identifier
      type: object
      properties:
        identifier:
          type:
            - 'null'
            - string
          description: Stable related artifact identifier.
        filePath:
          type:
            - 'null'
            - string
          description: Repository-relative file path.
        startLine:
          type:
            - 'null'
            - integer
          description: 1-based artifact start line.
          format: int32
        shortSummary:
          type:
            - 'null'
            - string
          description: AI-generated short summary.
      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.