> ## 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:
                $ref: '#/components/schemas/ToolApiEnvelope'
              example:
                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}]}]}
            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
    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

````