Skip to content

Agent Connection Tools API

These endpoints manage which connection-instance tools are enabled for a specific AI agent. All paths are under the /ai prefix.

For a conceptual overview of how connection tools work, see AI Connection Tools (Per Instance).

Authentication

Both endpoints require:

  • A valid Authorization: Bearer <jwt> token
  • A valid x-org-id header (or the orgId embedded in the JWT)
  • A CASL policy that allows read/update on the ai.agent subject

The JWT's agencyId and userId must correspond to a user who has visibility into the connections being referenced. Connections not accessible to the calling user are excluded from catalog responses and rejected in upsert requests.


GET /ai/agents/:agentId/connection-tools/catalog

Returns the list of connections accessible to the calling user in the org, their available tools (organized by provider type), and the currently enabled tools for each connection on this agent.

Path Parameters

ParameterTypeDescription
agentIdUUID v7The AI agent's identifier

Response — 200 OK

json
{
  "connections": [
    {
      "connectionId": "01927f3e-0000-7000-8000-000000000010",
      "name": "Work Gmail",
      "slug": "work-gmail",
      "provider": "google_gmail",
      "status": "active",
      "tools": [
        { "name": "send_gmail_message",  "description": "Send a Gmail message." },
        { "name": "list_gmail_messages", "description": "List Gmail messages." }
      ],
      "enabledTools": ["send_gmail_message"]
    },
    {
      "connectionId": "01927f3e-0000-7000-8000-000000000011",
      "name": "Agency Workspace",
      "slug": "agency-workspace",
      "provider": "google_workspace",
      "status": "active",
      "capabilities": [
        {
          "key": "gmail",
          "tools": [
            { "name": "send_gmail_message",  "description": "Send a Gmail message." },
            { "name": "list_gmail_messages", "description": "List Gmail messages." }
          ]
        },
        {
          "key": "sheets",
          "tools": [
            { "name": "list_spreadsheets",       "description": "List Google Sheets." },
            { "name": "read_spreadsheet_values",  "description": "Read values from a range." }
          ]
        },
        {
          "key": "calendar",
          "tools": [
            { "name": "list_calendar_events",  "description": "List calendar events." },
            { "name": "create_calendar_event", "description": "Create a calendar event." }
          ]
        }
      ],
      "enabledTools": ["send_gmail_message", "list_calendar_events"]
    }
  ]
}

Response fields per connection entry:

FieldTypeNotes
connectionIdUUID v7Connection identifier
namestringHuman-readable connection name
slugstringKebab slug used to namespace tools in the LLM tool set (e.g. work-gmail)
providerstringProvider key: smtp, telegram, google_gmail, google_workspace
statusstringactive, error, or disconnected
toolsarrayFor non-google_workspace providers: flat list of available tool descriptors
capabilitiesarrayFor google_workspace only: tool descriptors grouped by capability (gmail, sheets, calendar)
enabledToolsstring[]Tool names currently granted for this connection on this agent. [] when nothing is enabled.

Only one of tools or capabilities will be present, depending on provider.

Errors

StatusWhen
401Missing or invalid JWT
403Caller cannot read the ai.agent subject
404Agent not found in the org

Example

bash
curl -X GET \
  "https://api.daramex.app/ai/agents/01927f3e-0000-7000-8000-000000000001/connection-tools/catalog" \
  -H "Authorization: Bearer <jwt>" \
  -H "x-org-id: 01927f3e-0000-7000-8000-000000000002"

PUT /ai/agents/:agentId/connection-tools

Replaces the full set of connection-tool grants for an agent. This is a full-diff replace — the payload represents the complete desired state. Any connection not included in grants will have all its tools disabled.

To disable all tools for all connections, send { "grants": [] }.

Path Parameters

ParameterTypeDescription
agentIdUUID v7The AI agent's identifier

Request Body

json
{
  "grants": [
    {
      "connectionId": "01927f3e-0000-7000-8000-000000000010",
      "enabledTools": ["send_gmail_message"]
    },
    {
      "connectionId": "01927f3e-0000-7000-8000-000000000011",
      "enabledTools": ["send_gmail_message", "list_calendar_events"]
    }
  ]
}
FieldTypeConstraintsDescription
grantsarraymax 64 itemsFull desired grant set. Empty array removes all grants.
grants[].connectionIdUUID v7requiredMust be a connection accessible to the calling user in the org
grants[].enabledToolsstring[]min 1, max 64 itemsTool names from the provider's catalog. Must be valid for the connection's provider type.

Response — 200 OK

json
{
  "agentId": "01927f3e-0000-7000-8000-000000000001",
  "grants": [
    {
      "connectionId": "01927f3e-0000-7000-8000-000000000010",
      "enabledTools": ["send_gmail_message"]
    },
    {
      "connectionId": "01927f3e-0000-7000-8000-000000000011",
      "enabledTools": ["send_gmail_message", "list_calendar_events"]
    }
  ]
}

The response echoes the persisted state. Slugs are not included in the upsert response — use GET catalog to retrieve slugs.

Errors

StatusCodeWhen
400AI.EMPTY_ENABLED_TOOLS_FOR_CONNECTIONA grant entry has enabledTools: []. Use an absent entry to remove a connection's grant.
400AI.INVALID_CONNECTION_TOOL_NAMESOne or more tool names are not valid for the connection's provider type
400AI.DUPLICATE_CONNECTION_IDSThe same connectionId appears more than once in grants
401Missing or invalid JWT
403Caller cannot update the ai.agent subject, or a referenced connection is not accessible
404AI.AGENT_NOT_FOUNDAgent not found in the org
422Request body fails Zod validation (e.g. invalid UUID format)

Example — grant two connections

bash
curl -X PUT \
  "https://api.daramex.app/ai/agents/01927f3e-0000-7000-8000-000000000001/connection-tools" \
  -H "Authorization: Bearer <jwt>" \
  -H "x-org-id: 01927f3e-0000-7000-8000-000000000002" \
  -H "Content-Type: application/json" \
  -d '{
    "grants": [
      { "connectionId": "01927f3e-0000-7000-8000-000000000010", "enabledTools": ["send_gmail_message"] }
    ]
  }'

Example — remove all connection-tool grants

bash
curl -X PUT \
  "https://api.daramex.app/ai/agents/01927f3e-0000-7000-8000-000000000001/connection-tools" \
  -H "Authorization: Bearer <jwt>" \
  -H "x-org-id: 01927f3e-0000-7000-8000-000000000002" \
  -H "Content-Type: application/json" \
  -d '{ "grants": [] }'

Example — 400 invalid tool name for provider

bash
# Request — send_telegram_message is not valid for a google_gmail connection
curl -X PUT ... -d '{
  "grants": [
    { "connectionId": "01927f3e-0000-7000-8000-000000000010",
      "enabledTools": ["send_telegram_message"] }
  ]
}'

# Response 400
{
  "statusCode": 400,
  "code": "AI.INVALID_CONNECTION_TOOL_NAMES",
  "message": "Some tool names are not valid for this connection's provider",
  "details": {
    "connectionId": "01927f3e-0000-7000-8000-000000000010",
    "invalidTools": ["send_telegram_message"]
  }
}