Custom Tools

Service Connectors

Service connectors let your AI talk to external services — GitHub, Slack, weather APIs, your CRM, anything with an API. You describe what you need; your AI builds the connector and handles authentication.

You don't write this code

The code blocks below show what your AI generates under the hood. You just describe what you want in plain language: "build me a tool that creates GitHub issues."

Aliases

Old tool names like create_dynamic_tool and create_connection still work but are deprecated. Use tool(action="create", ...) and connection(action="create", ...) instead.


Creating an HTTP Proxy Tool

tool(action="create",
  name="github_create_issue",
  description="Create an issue in a GitHub repository",
  tool_type="http_proxy",
  input_schema={
    type: "object",
    properties: {
      owner: { type: "string", description: "Repository owner" },
      repo: { type: "string", description: "Repository name" },
      title: { type: "string", description: "Issue title" },
      body: { type: "string", description: "Issue body" }
    },
    required: ["owner", "repo", "title"]
  },
  http_config={
    method: "POST",
    url_template: "https://api.github.com/repos/{{owner}}/{{repo}}/issues",
    body_template: {
      title: "{{title}}",
      body: "{{body}}"
    },
    headers: {
      "Accept": "application/vnd.github.v3+json"
    },
    connection_id: "my-github-connection"
  })

HTTP Config Options

FieldTypeDescription
methodstringHTTP method: GET, POST, PUT, DELETE, PATCH
url_templatestringURL with {{variable}} placeholders
body_templateobjectRequest body with placeholders
headersobjectStatic headers to include
connection_idstringID of connection for auth
response_transformstringJSONata expression to transform response

Template Syntax

Use {{variable}} to insert input values:

{
  "url_template": "https://api.example.com/users/{{userId}}/posts",
  "body_template": {
    "title": "{{title}}",
    "content": "{{content}}",
    "tags": "{{tags}}"
  }
}

Nested Access

{{user.profile.name}}

Setting Up Connections

Before using HTTP proxy tools, create a connection for authentication. See Connections for the full guide.

API Key Authentication

connection(action="create",
  name="my-github-connection",
  provider="github",
  auth_type="api_key",
  api_key_config={
    key: "ghp_xxxxxxxxxxxxxxxxxxxx",
    header_name: "Authorization",
    prefix: "Bearer "
  })

Bearer Token

connection(action="create",
  name="my-api-connection",
  provider="custom",
  auth_type="bearer",
  api_key_config={
    key: "your-token-here"
  })

Basic Auth

connection(action="create",
  name="my-basic-auth",
  provider="custom",
  auth_type="basic",
  basic_auth_config={
    username: "user",
    password: "pass"
  })

Secure Credential Entry

Use secret_url to enter credentials in the browser instead of the chat. Secrets never appear in the conversation:

connection(action="secret_url", connection_id="my-github-connection")

This returns a secure browser link. Open the link, enter your credentials, and they're saved directly to the connection.


Response Transform

Transform API responses using JSONata:

tool(action="create",
  name="get_weather",
  tool_type="http_proxy",
  http_config={
    method: "GET",
    url_template: "https://api.openweathermap.org/data/2.5/weather?q={{city}}&units=metric",
    connection_id: "weather-api",
    response_transform: "{ 'temp': main.temp, 'description': weather[0].description }"
  })

Common transforms:

// Extract nested data
response.data.results

// Map to simpler structure
$map(response.items, function($v) { {"id": $v.id, "name": $v.name} })

// Filter results
$filter(response.items, function($v) { $v.active })

Example: Slack Notification

connection(action="create",
  name="slack-bot",
  provider="slack",
  auth_type="bearer",
  api_key_config={
    key: "xoxb-your-token"
  })

tool(action="create",
  name="slack_post_message",
  description="Post a message to a Slack channel",
  tool_type="http_proxy",
  input_schema={
    type: "object",
    properties: {
      channel: { type: "string" },
      text: { type: "string" }
    },
    required: ["channel", "text"]
  },
  http_config={
    method: "POST",
    url_template: "https://slack.com/api/chat.postMessage",
    body_template: {
      channel: "{{channel}}",
      text: "{{text}}"
    },
    connection_id: "slack-bot"
  })

Example: Weather API

connection(action="create",
  name="weather-api",
  provider="openweathermap",
  auth_type="api_key",
  api_key_config={
    key: "your-api-key",
    query_param: "appid"
  })

tool(action="create",
  name="get_weather",
  description="Get current weather for a city",
  tool_type="http_proxy",
  input_schema={
    type: "object",
    properties: {
      city: { type: "string" }
    },
    required: ["city"]
  },
  http_config={
    method: "GET",
    url_template: "https://api.openweathermap.org/data/2.5/weather?q={{city}}&units=metric",
    connection_id: "weather-api",
    response_transform: "{ 'temp': main.temp, 'description': weather[0].description }"
  })

Testing

Test tools before activating:

tool(action="test", tool_id="tool_abc123", test_input={ owner: "test", repo: "test", title: "Test Issue" })

API Reference

For the full technical reference, see tool Tool Reference and connection Tool Reference.

Previous
Code Tools