Custom Tools
HTTP Proxy Tools
HTTP proxy tools let you call external APIs through Kyew with proper authentication handling.
Creating an HTTP Proxy Tool
create_dynamic_tool({
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"
},
activate: true
})
HTTP Config Options
| Field | Type | Description |
|---|---|---|
| method | string | HTTP method: GET, POST, PUT, DELETE, PATCH |
| url_template | string | URL with {{variable}} placeholders |
| body_template | object | Request body with placeholders |
| headers | object | Static headers to include |
| connection_id | string | ID of connection for auth |
| response_transform | string | JSONata 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:
API Key Authentication
create_connection({
name: "my-github-connection",
provider: "github",
auth_type: "api_key",
api_key_config: {
key: "ghp_xxxxxxxxxxxxxxxxxxxx",
header_name: "Authorization",
prefix: "Bearer "
}
})
Bearer Token
create_connection({
name: "my-api-connection",
provider: "custom",
auth_type: "bearer",
api_key_config: {
key: "your-token-here"
}
})
Basic Auth
create_connection({
name: "my-basic-auth",
provider: "custom",
auth_type: "basic",
basic_auth_config: {
username: "user",
password: "pass"
}
})
Response Transform
Transform API responses using JSONata:
{
http_config: {
// ...
response_transform: "data.items"
}
}
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
create_connection({
name: "slack-webhook",
provider: "slack",
auth_type: "bearer",
api_key_config: {
key: "xoxb-your-token"
}
})
create_dynamic_tool({
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-webhook"
}
})
Example: Weather API
create_connection({
name: "weather-api",
provider: "openweathermap",
auth_type: "api_key",
api_key_config: {
key: "your-api-key",
query_param: "appid"
}
})
create_dynamic_tool({
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:
"test tool github_create_issue with owner='test' repo='test' title='Test Issue'"