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

# Attach Tool To Node

> Attach a CONFIGURED tool *instance* to a workflow node.

Workflow nodes never reference tool *types* (registry keys) directly —
they only reference instances that already exist in `agent_tools`. The
rule: a user cannot attach `cold_transfer` to a node; they must first
create a configured instance like `transfer_to_billing` (with its
sip_trunk_id, target_number, etc.) on an agent, then attach that
instance_name here.

Validation:
  - If `?agent_id=` is provided, the (agent_id, instance_name) pair
    MUST exist in `agent_tools` (active + enabled). Strict.
  - Otherwise, the instance_name MUST exist on at least one agent
    currently using this workflow (i.e. `agents.workflow_id == this`).
  - If the workflow is not yet attached to any agent, the request is
    rejected with 422 — bind the workflow to an agent first, then
    attach instances. (Avoids accumulating dangling string refs that
    only fail at runtime.)



## OpenAPI

````yaml https://api.mrassistant.ai/openapi.json post /workflows/{workflow_id}/nodes/{node_id}/tools
openapi: 3.1.0
info:
  title: Backend - Multilingual Voice Agent System
  description: FastAPI backend for multilingual voice agents with tool use
  version: 1.0.0
servers: []
security: []
paths:
  /workflows/{workflow_id}/nodes/{node_id}/tools:
    post:
      tags:
        - workflows
      summary: Attach Tool To Node
      description: |-
        Attach a CONFIGURED tool *instance* to a workflow node.

        Workflow nodes never reference tool *types* (registry keys) directly —
        they only reference instances that already exist in `agent_tools`. The
        rule: a user cannot attach `cold_transfer` to a node; they must first
        create a configured instance like `transfer_to_billing` (with its
        sip_trunk_id, target_number, etc.) on an agent, then attach that
        instance_name here.

        Validation:
          - If `?agent_id=` is provided, the (agent_id, instance_name) pair
            MUST exist in `agent_tools` (active + enabled). Strict.
          - Otherwise, the instance_name MUST exist on at least one agent
            currently using this workflow (i.e. `agents.workflow_id == this`).
          - If the workflow is not yet attached to any agent, the request is
            rejected with 422 — bind the workflow to an agent first, then
            attach instances. (Avoids accumulating dangling string refs that
            only fail at runtime.)
      operationId: attach_tool_to_node_workflows__workflow_id__nodes__node_id__tools_post
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workflow Id
        - name: node_id
          in: path
          required: true
          schema:
            type: string
            title: Node Id
        - name: agent_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Agent Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NodeToolAttachRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    NodeToolAttachRequest:
      properties:
        instance_name:
          type: string
          maxLength: 120
          minLength: 1
          title: Instance Name
        parameters:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Parameters
      type: object
      required:
        - instance_name
      title: NodeToolAttachRequest
      description: Body for POST /workflows/{wf}/nodes/{node}/tools.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````