Tools/Agent Tools

Agent Tools

The 26 organization-scoped tools shared by MCP, the tools REST API, and the local CLI.

One registry. MCP, GET/POST /api/v1/tools/{name}, and pnpm tools all expose these 26 tools and run the existing Admin API. Setup is in Configure AI Agents.

Each tool has a required API-key scope. A default dashboard key can run the write-link and events:write tools, but not members, customers, imports, domain writes, or archive.

Account

ToolScopeHTTP
get_organizationaccount:readGET /api/v1/me

Empty input. Use it as a connectivity check.

Members

Requires members:read, which is not on the default key.

ToolScopeHTTP
list_membersmembers:readGET /api/v1/members
get_membermembers:readGET /api/v1/members/:memberId

get_member takes { "memberId": "…" }. See Members API.

Domains

ToolScopeHTTP
list_domainsdomains:readGET /api/v1/domains
get_domaindomains:readGET /api/v1/domains/:domainId
create_domaindomains:writePOST /api/v1/domains
update_domaindomains:writePATCH /api/v1/domains/:domainId

list_domains accepts { "cursor", "limit" } (1–100, default 50). create_domain takes hostname, optional isPrimary, optional fallbackUrl. A domain only starts redirecting once verification succeeds. See Domains and Imports API.

ToolScopeHTTP
list_linkslinks:readGET /api/v1/links
get_linklinks:readGET /api/v1/links/:linkId
list_sublinkslinks:readGET /api/v1/links/:linkId/sublinks
create_parent_linklinks:writePOST /api/v1/links
create_sublinklinks:writePOST /api/v1/links/:linkId/sublinks
update_linklinks:writePATCH /api/v1/links/:linkId
archive_linklinks:archiveDELETE /api/v1/links/:linkId

create_parent_link requires domainId, slug, name, destinationUrl, and idempotencyKey. Optional social fields: title, description, imageUrl.

create_sublink requires parent linkId, slug, name, and idempotencyKey. Optional: context, utmSource, utmMedium, utmCampaign, utmTerm, utmContent.

update_link patches only the fields you send. A sublink cannot set destinationUrl. archive_link is the only lifecycle delete; it is marked destructive in MCP.

See Links API and Create a Link.

Analytics

ToolScopeHTTP
get_organization_analyticsanalytics:readGET /api/v1/analytics
get_link_analyticsanalytics:readGET /api/v1/links/:linkId/analytics

Both take optional dateFrom / dateTo as YYYY-MM-DD inclusive UTC days, max 367 days. Link analytics is for a parent id. See Analytics API.

Customers

Requires customers:read, not on the default key.

ToolScopeHTTP
list_customerscustomers:readGET /api/v1/customers
get_customer_journeycustomers:readGET /api/v1/customers/:externalId

list_customers accepts cursor, limit, optional linkId. get_customer_journey uses your application’s externalId. See Customers and Attribution and Events.

Events and tracking

ToolScopeHTTP
list_eventsevents:readGET /api/v1/events
create_eventevents:writePOST /api/v1/events
track_leadevents:writePOST /api/v1/track/lead
track_saleevents:writePOST /api/v1/track/sale

Funnel order is click → lead → sale. track_lead needs externalCustomerId or customerEmail, plus idempotencyKey. track_sale needs externalCustomerId, amount (minor units), and either invoiceId or idempotencyKey.

list_events needs events:read, which the default key does not have. track_lead / track_sale / create_event use events:write, which it does.

See Attribution and Events.

Imports

Requires imports:read / imports:write. Neither is on the default key.

ToolScopeHTTP
list_importsimports:readGET /api/v1/imports
get_importimports:readGET /api/v1/imports/:importId
list_import_itemsimports:readGET /api/v1/imports/:importId/items
create_importimports:writePOST /api/v1/imports

create_import takes source (csv | dub), domainId, conflictStrategy (skip | update), and content (CSV text, ≤ 1 MB). Returns 202. See Domains and Imports API.

Calling a tool

MCP: the client sends the tool name and a JSON object matching the input schema.

REST:

curl -X POST https://kliq.sh/api/v1/tools/track_lead \
  -H "Authorization: Bearer $KLIQ_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "customerEmail": "user@example.com",
    "eventName": "Waitlist",
    "idempotencyKey": "waitlist-user-example"
  }'

Success: { "data": … }. Failure: { "message": "…" } with the Admin API status (401, 403, 404, 409, 422, …).

CLI (pnpm tools in this repo). Reads KLIQ_API_KEY and KLIQ_API_URL (or VITE_CONVEX_SITE_URL) and sends x-api-key plus x-tool-source: cli:

pnpm tools run track_lead '{"customerEmail":"user@example.com","eventName":"Waitlist","idempotencyKey":"waitlist-user-example"}'

GET /api/v1/tools/{name} returns the JSON Schema, required scope, and the underlying HTTP route. Use that when generating a skill or a typed client instead of hard-coding argument names.