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

# Fetch artifacts

> Fetches full content for up to 50 known artifact identifiers (`repository::path` or `repository::path::symbol`) returned by `semantic_search`, `grep_search`, `read_file`, or `get_artifact_relationships`. This is the preferred way to read code once an identifier is known — do not split the identifier back into a repository and path for `read_file`. Responses include relationship previews (caller/callee counts) that suggest the next traversal step.



## OpenAPI

````yaml /openapi-tool-api-v3.json post /api/tools/fetch_artifacts
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/fetch_artifacts:
    post:
      tags:
        - ToolApi
      summary: Fetch artifacts
      description: >-
        Fetches full content for up to 50 known artifact identifiers
        (`repository::path` or `repository::path::symbol`) returned by
        `semantic_search`, `grep_search`, `read_file`, or
        `get_artifact_relationships`. This is the preferred way to read code
        once an identifier is known — do not split the identifier back into a
        repository and path for `read_file`. Responses include relationship
        previews (caller/callee counts) that suggest the next traversal step.
      operationId: ToolApiFetchArtifacts
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FetchArtifactsToolRequest'
            example:
              identifiers:
                - CodeAlive-AI/agent-framework::README.md
          text/json:
            schema:
              $ref: '#/components/schemas/FetchArtifactsToolRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/FetchArtifactsToolRequest'
      responses:
        '200':
          description: >-
            Success envelope. obj.artifacts[] returns each requested identifier
            with found, content, contentByteSize, startLine, and a relationships
            preview (caller/callee counts); 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/ArtifactContentResponse'
                      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/ArtifactContentResponse'
                    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:
                      artifacts:
                        - identifier: >-
                            CodeAlive-AI/agent-framework::src/executor.py::TaskExecutor.run
                          found: true
                          content: |-
                            def run(self, task):
                                with self._telemetry.span(task):
                                    return self._retry(task)
                          contentByteSize: 2048
                          startLine: 42
                          relationships:
                            incomingCallsCount: 2
                            incomingCalls:
                              - identifier: >-
                                  CodeAlive-AI/agent-framework::src/scheduler.py::Scheduler.tick
                                summary: Drains the queue and dispatches due tasks.
                      hint: >-
                        Use get_artifact_relationships to expand callers or
                        callees.
                    rendered: >-
                      {"artifacts":[{"identifier":"CodeAlive-AI/agent-framework::src/executor.py::TaskExecutor.run","found":true,"content":"def
                      run(self, task): ...","startLine":42}],"hint":"Use
                      get_artifact_relationships to expand callers or callees."}
                json_only:
                  summary: JSON success response
                  description: Returned when output_format is json.
                  value:
                    obj:
                      artifacts:
                        - identifier: >-
                            CodeAlive-AI/agent-framework::src/executor.py::TaskExecutor.run
                          found: true
                          content: |-
                            def run(self, task):
                                with self._telemetry.span(task):
                                    return self._retry(task)
                          contentByteSize: 2048
                          startLine: 42
                          relationships:
                            incomingCallsCount: 2
                            incomingCalls:
                              - identifier: >-
                                  CodeAlive-AI/agent-framework::src/scheduler.py::Scheduler.tick
                                summary: Drains the queue and dispatches due tasks.
                      hint: >-
                        Use get_artifact_relationships to expand callers or
                        callees.
                agentic_only:
                  summary: Agent-facing success response
                  description: Returned when output_format is agentic.
                  value:
                    rendered: >-
                      {"artifacts":[{"identifier":"CodeAlive-AI/agent-framework::src/executor.py::TaskExecutor.run","found":true,"content":"def
                      run(self, task): ...","startLine":42}],"hint":"Use
                      get_artifact_relationships to expand callers or callees."}
                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:
    FetchArtifactsToolRequest:
      required:
        - identifiers
      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.
        identifiers:
          maxItems: 50
          type:
            - 'null'
            - array
          items:
            type: string
          description: >-
            Up to 50 artifact identifiers returned by semantic_search,
            grep_search, read_file, or get_artifact_relationships.
        data_source:
          type:
            - 'null'
            - string
          description: >-
            Optional repository or workspace name/id used to disambiguate
            identifiers.
      additionalProperties: false
    ArtifactContentResponse:
      required:
        - artifacts
      type: object
      properties:
        artifacts:
          type:
            - 'null'
            - array
          items:
            $ref: '#/components/schemas/ArtifactContentDto'
          description: One result per requested identifier.
        hint:
          type:
            - 'null'
            - string
          description: Suggested graph-traversal follow-up.
        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
    ArtifactContentDto:
      required:
        - identifier
      type: object
      properties:
        identifier:
          type:
            - 'null'
            - string
          description: Requested artifact identifier.
        found:
          type: boolean
          description: Whether the artifact resolved within the caller scope.
        content:
          type:
            - 'null'
            - string
          description: Decrypted artifact content when extractable.
        contentByteSize:
          type:
            - 'null'
            - integer
          description: Artifact content size in bytes.
          format: int64
        startLine:
          type:
            - 'null'
            - integer
          description: 1-based artifact start line.
          format: int32
        relationships:
          $ref: '#/components/schemas/RelationshipsPreviewDto'
          description: Call counts and bounded caller/callee previews.
      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
    RelationshipsPreviewDto:
      type: object
      properties:
        outgoingCallsCount:
          type:
            - 'null'
            - integer
          description: Total accessible outgoing calls.
          format: int32
        outgoingCalls:
          type:
            - 'null'
            - array
          items:
            $ref: '#/components/schemas/ConnectionPreviewDto'
          description: Bounded preview of called artifacts.
        incomingCallsCount:
          type:
            - 'null'
            - integer
          description: Total accessible incoming calls.
          format: int32
        incomingCalls:
          type:
            - 'null'
            - array
          items:
            $ref: '#/components/schemas/ConnectionPreviewDto'
          description: Bounded preview of calling artifacts.
      additionalProperties: false
    ConnectionPreviewDto:
      required:
        - identifier
      type: object
      properties:
        identifier:
          type:
            - 'null'
            - string
          description: Stable identifier of the connected artifact.
        summary:
          type:
            - 'null'
            - string
          description: AI-generated short summary of the connected artifact.
      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.