Tools

The tools your agents use to call your own systems and connected services: create, change, test and remove them, and read their runs, health and usage. Requires `tools:read` to read and `tools:write` to change or test.

List tools
GET /tools
Create a tool
POST /tools
Get call totals for all tools
GET /tools/overview
Get a tool
GET /tools/{id}
Update a tool
PATCH /tools/{id}
Delete a tool
DEL /tools/{id}
Test a tool
POST /tools/{id}/test
List a tool's recent calls
GET /tools/{id}/runs
Get a tool's health
GET /tools/{id}/health
List playbooks that use a tool
GET /tools/{id}/usage

The Tool object

Returned by the tools endpoints.

Attributes
outcomestring
The outcome name: the class, or a failure code such as `not_connected`, `timeout`, `http_status` or `blocked`.
classenum
—successemptyfailure
varsobject
The values kept from the response, by name.
rawstring
The response body exactly as the provider sent it.
latencyMsinteger
—
modeenum
—livemock
deciderstring
What decided the class: `transport` (the call didn't complete), `status` (the endpoint answered with a non-2xx status) or `structural` (the response body was read: an empty body or all-blank kept values means `empty`, otherwise `success`). `forced`, `dry_run` and `replayed` don't occur in tests.
notestring
Why the class was chosen, in words.
failureCodeenum
Set when the class is `failure`.not_connectedunknown_toolinvalid_inputprovidertimeouthttp_statusblockedcancelledno_idem_key
errorstring
The failure message, when there is one.
The Tool object
{
  "outcome": "success",
  "class": "success",
  "vars": {
    "check_in_date": "2026-10-17"
  },
  "raw": "{"booking":{"reference":"HV-20481","checkIn":"2026-10-17"}}",
  "latencyMs": 412,
  "mode": "live",
  "decider": "structural",
  "note": "every kept value came back blank",
  "failureCode": "http_status",
  "error": "the endpoint answered 404"
}

List tools

GET https://api.trycareflow.com/tools

Requires `tools:read`. Returns every tool in the API key's workspace, in any status, in no particular order. There's no paging. Secrets in `endpoint` are masked.

curl https://api.trycareflow.com/tools \
  -H "Authorization: Bearer sk_live_••••"
const Tool = await careflow.tools.list()
Response
{
  "code": "SUCCESS",
  "message": "ok",
  "data": {
    "tools": [
      {
        "_id": "66f1c2a9e4b0f1a2b3c4d5e6",
        "createdAt": "2026-09-14T09:12:00Z",
        "updatedAt": "2026-09-14T09:40:00Z",
        "businessId": "66f1c2a9e4b0f1a2b3c4d501",
        "key": "look_up_booking",
        "displayName": "Look up a booking",
        "name": "look_up_booking",
        "description": "Use when a guest asks about an existing reservation and gives a booking reference.",
        "type": "api",
        "effect": "read",
        "resolvedEffect": "read",
        "integrationKey": "",
        "catalogToolName": "",
        "endpoint": {
          "method": "GET",
          "url": "https://api.harbourviewhotel.example/v1/bookings/$input.booking_reference",
          "headers": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ],
          "auth": {
            "type": "bearer",
            "token": "••••••••"
          },
          "bodyMode": "none"
        },
        "parameters": [
          {
            "field": "booking_reference",
            "mode": "fetch_from_agent",
            "paramName": "booking_reference",
            "paramDescription": "The guest's booking reference, such as HV-20481",
            "type": "string",
            "required": true,
            "identity": true
          },
          {
            "field": "property",
            "mode": "static",
            "value": "harbourview-main"
          }
        ],
        "status": "draft",
        "vars": [
          {
            "name": "check_in_date",
            "path": "$.booking.checkIn",
            "type": "date"
          }
        ],
        "lastTest": {
          "at": "2026-09-14T09:38:12Z",
          "mode": "live",
          "outcome": "success",
          "class": "success",
          "latencyMs": 412
        }
      },
      {
        "_id": "66f1c2a9e4b0f1a2b3c4d5e7",
        "createdAt": "2026-08-02T14:05:00Z",
        "updatedAt": "2026-08-20T10:11:00Z",
        "businessId": "66f1c2a9e4b0f1a2b3c4d501",
        "key": "check_todays_slots",
        "displayName": "Check today's availability",
        "name": "check_todays_slots",
        "description": "Use when a caller asks what times are free today.",
        "type": "integration",
        "resolvedEffect": "read",
        "integrationKey": "google_calendar",
        "catalogToolName": "google_calendar_list_events",
        "catalogOutputs": [
          {
            "name": "events",
            "type": "array",
            "description": "Events in the window"
          }
        ],
        "parameters": [
          {
            "field": "timeMin",
            "mode": "static",
            "value": "{env.today_start}"
          }
        ],
        "status": "active"
      }
    ]
  }
}
{
  "code": "ERROR",
  "message": "unauthorized",
  "error": "invalid or revoked API key"
}
{
  "code": "ERROR",
  "message": "insufficient_scope",
  "error": "this API key needs the knowledge:write scope"
}
{
  "code": "ERROR",
  "message": "too_many_requests",
  "error": "You have exceeded the rate limit for api. Please try again in 12s."
}
{
  "code": "ERROR",
  "message": "failed",
  "error": "<database error>"
}
{
  "code": "ERROR",
  "message": "service_unavailable",
  "error": "key lookup failed"
}

Create a tool

POST https://api.trycareflow.com/tools

Requires `tools:write`. Creates a tool in the API key's workspace. Every new tool starts as a `draft`, which agents never use. Test it with `POST /tools/{id}/test`, then set `status` to `active`. For an `integration` tool, set `integrationKey` and `catalogToolName` to an operation of an app the workspace has connected. For an `api` tool, set `type` to `api` and describe the HTTPS request in `endpoint`. Credentials in `endpoint` are encrypted when stored and are never returned; responses show `••••••••` in their place. Response values can't be named on create; send `vars` with `PATCH /tools/{id}`.

Parameters
typeenumoptional
How the tool runs. Leave it out for an `integration` tool. Use `api` for a request you define in `endpoint`. `function` and `mcp` are accepted but can't run yet.integrationapifunctionmcp
keystringoptional
A stable handle. Left out on create, it's made from `displayName`, or from `name`.
displayNamestringoptional
The name people see in the dashboard.
namestringrequired
The function name the agent sees. Can't be blank.
descriptionstringoptional
Tells the agent when to use the tool.
integrationKeystringoptional
For an `integration` tool: the connected app, such as `google_calendar`.
catalogToolNamestringoptional
For an `integration` tool: the app operation to run.
parametersarray<object>optional
The tool's inputs. On update, the list replaces the stored one.
effectenumoptional
What the tool does. Leave it out to use the connected app's own effect, or `write` for an `api` tool. Only `read` tools may run freely and be retried; writes run from playbook steps unless `direct` is set.readwriteirreversible
directbooleanoptional
Let the agent call a `write` tool outside a playbook, after the customer confirms. Not allowed for `irreversible` tools.
confirmPromptstringoptional
What the agent asks the customer to confirm before a direct write. Leading and trailing spaces are trimmed.
mockResponsestringoptional
A sample response body, used by a mock test.
endpointobjectoptional
For an `api` tool: the request it makes. Checked and stored whatever the `type`.
curl https://api.trycareflow.com/tools \
  -H "Authorization: Bearer sk_live_••••" \
  -d name=look_up_booking \
  -d type=api \
  -d key=look_up_booking \
  -d displayName=Look up a booking
const Tool = await careflow.tools.create({
  name: 'look_up_booking',
  type: 'api',
  key: 'look_up_booking',
  displayName: 'Look up a booking',
})
Response
{
  "code": "SUCCESS",
  "message": "created",
  "data": {
    "tool": {
      "_id": "66f1c2a9e4b0f1a2b3c4d5e6",
      "createdAt": "2026-09-14T09:12:00Z",
      "updatedAt": "2026-09-14T09:40:00Z",
      "businessId": "66f1c2a9e4b0f1a2b3c4d501",
      "key": "look_up_booking",
      "displayName": "Look up a booking",
      "name": "look_up_booking",
      "description": "Use when a guest asks about an existing reservation and gives a booking reference.",
      "type": "api",
      "effect": "read",
      "resolvedEffect": "read",
      "integrationKey": "",
      "catalogToolName": "",
      "endpoint": {
        "method": "GET",
        "url": "https://api.harbourviewhotel.example/v1/bookings/$input.booking_reference",
        "headers": [
          {
            "name": "Accept",
            "value": "application/json"
          }
        ],
        "auth": {
          "type": "bearer",
          "token": "••••••••"
        },
        "bodyMode": "none"
      },
      "parameters": [
        {
          "field": "booking_reference",
          "mode": "fetch_from_agent",
          "paramName": "booking_reference",
          "paramDescription": "The guest's booking reference, such as HV-20481",
          "type": "string",
          "required": true,
          "identity": true
        },
        {
          "field": "property",
          "mode": "static",
          "value": "harbourview-main"
        }
      ],
      "status": "draft",
      "vars": [
        {
          "name": "check_in_date",
          "path": "$.booking.checkIn",
          "type": "date"
        }
      ],
      "lastTest": {
        "at": "2026-09-14T09:38:12Z",
        "mode": "live",
        "outcome": "success",
        "class": "success",
        "latencyMs": 412
      }
    }
  }
}
{
  "code": "ERROR",
  "message": "validation failed",
  "error": "invalid_payload",
  "details": {
    "Name": "required"
  }
}
{
  "code": "ERROR",
  "message": "unauthorized",
  "error": "invalid or revoked API key"
}
{
  "code": "ERROR",
  "message": "insufficient_scope",
  "error": "this API key needs the knowledge:write scope"
}
{
  "code": "ERROR",
  "message": "too_many_requests",
  "error": "You have exceeded the rate limit for api. Please try again in 12s."
}
{
  "code": "ERROR",
  "message": "failed to create",
  "error": "<database error>"
}
{
  "code": "ERROR",
  "message": "service_unavailable",
  "error": "key lookup failed"
}

Get call totals for all tools

GET https://api.trycareflow.com/tools/overview

Requires `tools:read`. Returns call totals for the last 7 days for every tool in the workspace in one request, keyed by tool ID. Tools with no calls in that time are left out. Test runs aren't counted. `usedBy` is always 0 for now.

curl https://api.trycareflow.com/tools/overview \
  -H "Authorization: Bearer sk_live_••••"
const Tool = await careflow.tools.list()
Response
{
  "code": "SUCCESS",
  "message": "ok",
  "data": {
    "windowDays": 7,
    "tools": {
      "66f1c2a9e4b0f1a2b3c4d5e6": {
        "total": 120,
        "failures": 4,
        "failureRate": 0.0333,
        "usedBy": 0
      }
    }
  }
}
{
  "code": "ERROR",
  "message": "unauthorized",
  "error": "invalid or revoked API key"
}
{
  "code": "ERROR",
  "message": "insufficient_scope",
  "error": "this API key needs the knowledge:write scope"
}
{
  "code": "ERROR",
  "message": "too_many_requests",
  "error": "You have exceeded the rate limit for api. Please try again in 12s."
}
{
  "code": "ERROR",
  "message": "failed",
  "error": "<database error>"
}
{
  "code": "ERROR",
  "message": "service_unavailable",
  "error": "key lookup failed"
}

Get a tool

GET https://api.trycareflow.com/tools/{id}

Requires `tools:read`. Returns one tool from the API key's workspace. Secrets in `endpoint` are masked as `••••••••`. `resolvedEffect` and `notCallableBecause` tell you how agents will treat the tool.

Path parameters
idstringrequired
The tool's ID, a 24-character hex string.
curl https://api.trycareflow.com/tools/value \
  -H "Authorization: Bearer sk_live_••••"
const Tool = await careflow.tools.retrieve('value')
Response
{
  "code": "SUCCESS",
  "message": "ok",
  "data": {
    "tool": {
      "_id": "66f1c2a9e4b0f1a2b3c4d5e6",
      "createdAt": "2026-09-14T09:12:00Z",
      "updatedAt": "2026-09-14T09:40:00Z",
      "businessId": "66f1c2a9e4b0f1a2b3c4d501",
      "key": "look_up_booking",
      "displayName": "Look up a booking",
      "name": "look_up_booking",
      "description": "Use when a guest asks about an existing reservation and gives a booking reference.",
      "type": "api",
      "effect": "read",
      "resolvedEffect": "read",
      "integrationKey": "",
      "catalogToolName": "",
      "endpoint": {
        "method": "GET",
        "url": "https://api.harbourviewhotel.example/v1/bookings/$input.booking_reference",
        "headers": [
          {
            "name": "Accept",
            "value": "application/json"
          }
        ],
        "auth": {
          "type": "bearer",
          "token": "••••••••"
        },
        "bodyMode": "none"
      },
      "parameters": [
        {
          "field": "booking_reference",
          "mode": "fetch_from_agent",
          "paramName": "booking_reference",
          "paramDescription": "The guest's booking reference, such as HV-20481",
          "type": "string",
          "required": true,
          "identity": true
        },
        {
          "field": "property",
          "mode": "static",
          "value": "harbourview-main"
        }
      ],
      "status": "draft",
      "vars": [
        {
          "name": "check_in_date",
          "path": "$.booking.checkIn",
          "type": "date"
        }
      ],
      "lastTest": {
        "at": "2026-09-14T09:38:12Z",
        "mode": "live",
        "outcome": "success",
        "class": "success",
        "latencyMs": 412
      }
    }
  }
}
{
  "code": "ERROR",
  "message": "invalid id",
  "error": "the provided hex string is not a valid ObjectID"
}
{
  "code": "ERROR",
  "message": "unauthorized",
  "error": "invalid or revoked API key"
}
{
  "code": "ERROR",
  "message": "insufficient_scope",
  "error": "this API key needs the knowledge:write scope"
}
{
  "code": "ERROR",
  "message": "not found",
  "error": "mongo: no documents in result"
}
{
  "code": "ERROR",
  "message": "too_many_requests",
  "error": "You have exceeded the rate limit for api. Please try again in 12s."
}
{
  "code": "ERROR",
  "message": "service_unavailable",
  "error": "key lookup failed"
}

Update a tool

PATCH https://api.trycareflow.com/tools/{id}

Requires `tools:write`. Changes the fields you send and leaves the rest. `parameters`, `vars` and `endpoint` each replace the stored value as a whole. To keep a stored secret in `endpoint`, send it back as `••••••••`; it's kept only while the URL's host stays the same. Setting `status` to `active` works only after a live test that reached the provider. Changing a tool doesn't reset its last test. This endpoint doesn't check `status`, `type`, `effect` or the inputs' `mode` against their allowed values, so send only the values listed here.

Path parameters
idstringrequired
The tool's ID, a 24-character hex string.
Parameters
typeenumoptional
How the tool runs. Leave it out for an `integration` tool. Use `api` for a request you define in `endpoint`. `function` and `mcp` are accepted but can't run yet.integrationapifunctionmcp
keystringoptional
A stable handle. Left out on create, it's made from `displayName`, or from `name`.
displayNamestringoptional
The name people see in the dashboard.
namestringoptional
The function name the agent sees. Leading and trailing spaces are trimmed.
descriptionstringoptional
Tells the agent when to use the tool.
integrationKeystringoptional
For an `integration` tool: the connected app, such as `google_calendar`.
catalogToolNamestringoptional
For an `integration` tool: the app operation to run.
parametersarray<object>optional
The tool's inputs. On update, the list replaces the stored one.
effectenumoptional
What the tool does. Leave it out to use the connected app's own effect, or `write` for an `api` tool. Only `read` tools may run freely and be retried; writes run from playbook steps unless `direct` is set.readwriteirreversible
directbooleanoptional
Let the agent call a `write` tool outside a playbook, after the customer confirms. Not allowed for `irreversible` tools.
confirmPromptstringoptional
What the agent asks the customer to confirm before a direct write. Leading and trailing spaces are trimmed.
mockResponsestringoptional
A sample response body, used by a mock test.
endpointobjectoptional
Replaces the stored endpoint as a whole. Send secret fields as `••••••••` to keep the stored values; they are dropped if the URL's host changes.
statusenumoptional
Set `active` to offer the tool to agents. A tool can only become `active` after its last test was a `live` run that reached the provider (class `success` or `empty`) and it has a source (an `integrationKey`, or an endpoint URL for an `api` tool). A `disabled` tool can go back to `active` without a new test.draftactivedisabled
varsarray<object>optional
Values to keep from the response. Replaces the stored list. Each `path` must be a valid JSON path.
curl -X PATCH https://api.trycareflow.com/tools/value \
  -H "Authorization: Bearer sk_live_••••" \
  -d type=api \
  -d key=look_up_booking \
  -d displayName=Look up a booking \
  -d name=look_up_booking
const Tool = await careflow.tools.update({
  type: 'api',
  key: 'look_up_booking',
  displayName: 'Look up a booking',
  name: 'look_up_booking',
})
Response
{
  "code": "SUCCESS",
  "message": "updated",
  "data": {
    "tool": {
      "_id": "66f1c2a9e4b0f1a2b3c4d5e6",
      "createdAt": "2026-09-14T09:12:00Z",
      "updatedAt": "2026-09-14T10:02:00Z",
      "businessId": "66f1c2a9e4b0f1a2b3c4d501",
      "key": "look_up_booking",
      "displayName": "Look up a booking",
      "name": "look_up_booking",
      "description": "Use when a guest asks about an existing reservation and gives a booking reference.",
      "type": "api",
      "effect": "read",
      "resolvedEffect": "read",
      "integrationKey": "",
      "catalogToolName": "",
      "endpoint": {
        "method": "GET",
        "url": "https://api.harbourviewhotel.example/v1/bookings/$input.booking_reference",
        "headers": [
          {
            "name": "Accept",
            "value": "application/json"
          }
        ],
        "auth": {
          "type": "bearer",
          "token": "••••••••"
        },
        "bodyMode": "none"
      },
      "parameters": [
        {
          "field": "booking_reference",
          "mode": "fetch_from_agent",
          "paramName": "booking_reference",
          "paramDescription": "The guest's booking reference, such as HV-20481",
          "type": "string",
          "required": true,
          "identity": true
        },
        {
          "field": "property",
          "mode": "static",
          "value": "harbourview-main"
        }
      ],
      "status": "active",
      "vars": [
        {
          "name": "check_in_date",
          "path": "$.booking.checkIn",
          "type": "date"
        }
      ],
      "lastTest": {
        "at": "2026-09-14T09:38:12Z",
        "mode": "live",
        "outcome": "success",
        "class": "success",
        "latencyMs": 412
      }
    }
  }
}
{
  "code": "ERROR",
  "message": "invalid id",
  "error": "the provided hex string is not a valid ObjectID"
}
{
  "code": "ERROR",
  "message": "unauthorized",
  "error": "invalid or revoked API key"
}
{
  "code": "ERROR",
  "message": "insufficient_scope",
  "error": "this API key needs the knowledge:write scope"
}
{
  "code": "ERROR",
  "message": "not found",
  "error": "mongo: no documents in result"
}
{
  "code": "ERROR",
  "message": "test before going live",
  "error": "run a live test — a run that reached the provider is what lets this tool go live"
}
{
  "code": "ERROR",
  "message": "too_many_requests",
  "error": "You have exceeded the rate limit for api. Please try again in 12s."
}
{
  "code": "ERROR",
  "message": "failed",
  "error": "<database error>"
}
{
  "code": "ERROR",
  "message": "service_unavailable",
  "error": "key lookup failed"
}

Delete a tool

DEL https://api.trycareflow.com/tools/{id}

Requires `tools:write`. Deletes the tool for good. Agents stop using it straight away. Its call log isn't deleted.

Path parameters
idstringrequired
The tool's ID, a 24-character hex string.
curl -X DELETE https://api.trycareflow.com/tools/value \
  -H "Authorization: Bearer sk_live_••••"
const Tool = await careflow.tools.del('value')
Response
{
  "code": "SUCCESS",
  "message": "deleted"
}
{
  "code": "ERROR",
  "message": "invalid id",
  "error": "the provided hex string is not a valid ObjectID"
}
{
  "code": "ERROR",
  "message": "unauthorized",
  "error": "invalid or revoked API key"
}
{
  "code": "ERROR",
  "message": "insufficient_scope",
  "error": "this API key needs the knowledge:write scope"
}
{
  "code": "ERROR",
  "message": "not found",
  "error": "mongo: no documents in result"
}
{
  "code": "ERROR",
  "message": "too_many_requests",
  "error": "You have exceeded the rate limit for api. Please try again in 12s."
}
{
  "code": "ERROR",
  "message": "failed to delete",
  "error": "<database error>"
}
{
  "code": "ERROR",
  "message": "service_unavailable",
  "error": "key lookup failed"
}

Test a tool

POST https://api.trycareflow.com/tools/{id}/test

Requires `tools:write`. Runs the tool once and returns what happened. A live test (`mock` false) makes the real call: an `integration` tool runs against the app with the workspace's stored connection, and an `api` tool sends the HTTPS request to your endpoint with its stored credentials. A `write` tool really changes things in that system, so test with safe data. With `mock` true, nothing is called and the saved `mockResponse` is read as if it were the response. The result is saved on the tool as `lastTest`. Only a live run whose class is `success` or `empty` lets the tool go `active`. A call that fails still returns 200; check `class` and `failureCode`. Each call has 15 seconds, and the whole test 30. `raw` holds the full response body from the provider, which can include customer data. Test runs aren't counted in runs or health.

Path parameters
idstringrequired
The tool's ID, a 24-character hex string.
Parameters
argsobjectoptional
Input values for a live test, keyed by the `paramName` of `fetch_from_agent` inputs. Ignored for a mock test.
mockbooleanoptional
`true` reads the saved `mockResponse` instead of making the call.
curl https://api.trycareflow.com/tools/value/test \
  -H "Authorization: Bearer sk_live_••••" \
  -d args=[object Object] \
  -d mock=false
const Tool = await careflow.tools.create({
  args: '[object Object]',
  mock: 'false',
})
Response
{
  "code": "SUCCESS",
  "message": "ok",
  "data": {
    "outcome": "success",
    "class": "success",
    "vars": {
      "check_in_date": "2026-10-17"
    },
    "raw": "{"booking":{"reference":"HV-20481","checkIn":"2026-10-17"}}",
    "latencyMs": 412,
    "mode": "live",
    "decider": "structural"
  }
}
{
  "code": "ERROR",
  "message": "invalid id",
  "error": "the provided hex string is not a valid ObjectID"
}
{
  "code": "ERROR",
  "message": "unauthorized",
  "error": "invalid or revoked API key"
}
{
  "code": "ERROR",
  "message": "insufficient_scope",
  "error": "this API key needs the knowledge:write scope"
}
{
  "code": "ERROR",
  "message": "not found",
  "error": "mongo: no documents in result"
}
{
  "code": "ERROR",
  "message": "too_many_requests",
  "error": "You have exceeded the rate limit for api. Please try again in 12s."
}
{
  "code": "ERROR",
  "message": "service_unavailable",
  "error": "key lookup failed"
}

List a tool's recent calls

GET https://api.trycareflow.com/tools/{id}/runs

Requires `tools:read`. Returns the calls agents made to this tool, newest first. Calls are kept for 30 days. Test runs aren't included. An ID that matches no tool returns an empty list rather than 404.

Path parameters
idstringrequired
The tool's ID, a 24-character hex string.
Query parameters
limitintegeroptional
How many calls to return, from 1 to 200. Missing or out-of-range values use 50.
curl https://api.trycareflow.com/tools/value/runs \
  -H "Authorization: Bearer sk_live_••••"
const Tool = await careflow.tools.retrieve('value')
Response
{
  "code": "SUCCESS",
  "message": "ok",
  "data": {
    "runs": [
      {
        "id": "6710b3e2c4a1f09d8e7b6a52",
        "toolId": "66f1c2a9e4b0f1a2b3c4d5e6",
        "businessId": "66f1c2a9e4b0f1a2b3c4d501",
        "at": "2026-10-03T15:21:09Z",
        "outcome": "success",
        "class": "success",
        "latencyMs": 388
      }
    ]
  }
}
{
  "code": "ERROR",
  "message": "invalid id",
  "error": "the provided hex string is not a valid ObjectID"
}
{
  "code": "ERROR",
  "message": "unauthorized",
  "error": "invalid or revoked API key"
}
{
  "code": "ERROR",
  "message": "insufficient_scope",
  "error": "this API key needs the knowledge:write scope"
}
{
  "code": "ERROR",
  "message": "too_many_requests",
  "error": "You have exceeded the rate limit for api. Please try again in 12s."
}
{
  "code": "ERROR",
  "message": "failed",
  "error": "<database error>"
}
{
  "code": "ERROR",
  "message": "service_unavailable",
  "error": "key lookup failed"
}

Get a tool's health

GET https://api.trycareflow.com/tools/{id}/health

Requires `tools:read`. Sums up the tool's calls over the last 7 days: totals per class, failure rate and average time. Test runs aren't counted. An ID that matches no tool returns zero totals rather than 404.

Path parameters
idstringrequired
The tool's ID, a 24-character hex string.
curl https://api.trycareflow.com/tools/value/health \
  -H "Authorization: Bearer sk_live_••••"
const Tool = await careflow.tools.retrieve('value')
Response
{
  "code": "SUCCESS",
  "message": "ok",
  "data": {
    "windowDays": 7,
    "total": 120,
    "byClass": {
      "success": 110,
      "empty": 6,
      "failure": 4
    },
    "failureRate": 0.0333,
    "avgLatencyMs": 402.5
  }
}
{
  "code": "ERROR",
  "message": "invalid id",
  "error": "the provided hex string is not a valid ObjectID"
}
{
  "code": "ERROR",
  "message": "unauthorized",
  "error": "invalid or revoked API key"
}
{
  "code": "ERROR",
  "message": "insufficient_scope",
  "error": "this API key needs the knowledge:write scope"
}
{
  "code": "ERROR",
  "message": "too_many_requests",
  "error": "You have exceeded the rate limit for api. Please try again in 12s."
}
{
  "code": "ERROR",
  "message": "failed",
  "error": "<database error>"
}
{
  "code": "ERROR",
  "message": "service_unavailable",
  "error": "key lookup failed"
}

List playbooks that use a tool

GET https://api.trycareflow.com/tools/{id}/usage

Requires `tools:read`. Meant to list the playbooks that use this tool. For now it always returns an empty list.

Path parameters
idstringrequired
The tool's ID, a 24-character hex string.
curl https://api.trycareflow.com/tools/value/usage \
  -H "Authorization: Bearer sk_live_••••"
const Tool = await careflow.tools.retrieve('value')
Response
{
  "code": "SUCCESS",
  "message": "ok",
  "data": {
    "playbooks": []
  }
}
{
  "code": "ERROR",
  "message": "invalid id",
  "error": "the provided hex string is not a valid ObjectID"
}
{
  "code": "ERROR",
  "message": "unauthorized",
  "error": "invalid or revoked API key"
}
{
  "code": "ERROR",
  "message": "insufficient_scope",
  "error": "this API key needs the knowledge:write scope"
}
{
  "code": "ERROR",
  "message": "too_many_requests",
  "error": "You have exceeded the rate limit for api. Please try again in 12s."
}
{
  "code": "ERROR",
  "message": "service_unavailable",
  "error": "key lookup failed"
}