fix(clay): fixed clay tool (#1725)

* fixed clay tool

* added metadata

* added metadata to types

* fix(clay): remove (optional) from subblock name

* regen docs
This commit is contained in:
Adam Gough
2025-10-26 15:30:08 -10:00
committed by GitHub
parent c552bb9c5f
commit 274d5e3afc
6 changed files with 68 additions and 20 deletions

View File

@@ -214,14 +214,14 @@ Populate Clay with data from a JSON file. Enables direct communication and notif
| --------- | ---- | -------- | ----------- |
| `webhookURL` | string | Yes | The webhook URL to populate |
| `data` | json | Yes | The data to populate |
| `authToken` | string | Yes | Auth token for Clay webhook authentication |
| `authToken` | string | No | Optional auth token for Clay webhook authentication \(most webhooks do not require this\) |
#### Output
| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `success` | boolean | Operation success status |
| `output` | json | Clay populate operation results including response data from Clay webhook |
| `data` | json | Response data from Clay webhook |
| `metadata` | object | Webhook response metadata |

View File

@@ -7,7 +7,7 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
<BlockInfoCard
type="discord"
color="#E0E0E0"
color="#5865F2"
icon={true}
iconSvg={`<svg className="block-icon"

View File

@@ -143,6 +143,7 @@ Search for similar vectors in a Qdrant collection
| `vector` | array | Yes | Vector to search for |
| `limit` | number | No | Number of results to return |
| `filter` | object | No | Filter to apply to the search |
| `search_return_data` | string | No | Data to return from search |
| `with_payload` | boolean | No | Include payload in response |
| `with_vector` | boolean | No | Include vector in response |
@@ -165,6 +166,7 @@ Fetch points by ID from a Qdrant collection
| `apiKey` | string | No | Qdrant API key \(optional\) |
| `collection` | string | Yes | Collection name |
| `ids` | array | Yes | Array of point IDs to fetch |
| `fetch_return_data` | string | No | Data to return from fetch |
| `with_payload` | boolean | No | Include payload in response |
| `with_vector` | boolean | No | Include vector in response |

View File

@@ -38,10 +38,12 @@ Plain Text: Best for populating a table in free-form style.
title: 'Auth Token',
type: 'short-input',
layout: 'full',
placeholder: 'Enter your Clay Auth token',
placeholder: 'Enter your Clay webhook auth token',
password: true,
connectionDroppable: false,
required: true,
required: false,
description:
'Optional: If your Clay table has webhook authentication enabled, enter the auth token here. This will be sent in the x-clay-webhook-auth header.',
},
],
tools: {
@@ -53,6 +55,10 @@ Plain Text: Best for populating a table in free-form style.
data: { type: 'json', description: 'Data to populate' },
},
outputs: {
data: { type: 'json', description: 'Response data' },
data: { type: 'json', description: 'Response data from Clay webhook' },
metadata: {
type: 'json',
description: 'Webhook metadata including status, headers, timestamp, and content type',
},
},
}

View File

@@ -23,19 +23,27 @@ export const clayPopulateTool: ToolConfig<ClayPopulateParams, ClayPopulateRespon
},
authToken: {
type: 'string',
required: true,
required: false,
visibility: 'user-only',
description: 'Auth token for Clay webhook authentication',
description:
'Optional auth token for Clay webhook authentication (most webhooks do not require this)',
},
},
request: {
url: (params: ClayPopulateParams) => params.webhookURL,
method: 'POST',
headers: (params: ClayPopulateParams) => ({
'Content-Type': 'application/json',
Authorization: `Bearer ${params.authToken}`,
}),
headers: (params: ClayPopulateParams) => {
const headers: Record<string, string> = {
'Content-Type': 'application/json',
}
if (params.authToken && params.authToken.trim() !== '') {
headers['x-clay-webhook-auth'] = params.authToken
}
return headers
},
body: (params: ClayPopulateParams) => ({
data: params.data,
}),
@@ -43,27 +51,52 @@ export const clayPopulateTool: ToolConfig<ClayPopulateParams, ClayPopulateRespon
transformResponse: async (response: Response) => {
const contentType = response.headers.get('content-type')
let data
const timestamp = new Date().toISOString()
// Extract response headers
const headers: Record<string, string> = {}
response.headers.forEach((value, key) => {
headers[key] = value
})
// Parse response body
let responseData
if (contentType?.includes('application/json')) {
data = await response.json()
responseData = await response.json()
} else {
data = await response.text()
responseData = await response.text()
}
return {
success: true,
output: {
data: contentType?.includes('application/json') ? data : { message: data },
data: contentType?.includes('application/json') ? responseData : { message: responseData },
metadata: {
status: response.status,
statusText: response.statusText,
headers: headers,
timestamp: timestamp,
contentType: contentType || 'unknown',
},
},
}
},
outputs: {
success: { type: 'boolean', description: 'Operation success status' },
output: {
data: {
type: 'json',
description: 'Clay populate operation results including response data from Clay webhook',
description: 'Response data from Clay webhook',
},
metadata: {
type: 'object',
description: 'Webhook response metadata',
properties: {
status: { type: 'number', description: 'HTTP status code' },
statusText: { type: 'string', description: 'HTTP status text' },
headers: { type: 'object', description: 'Response headers from Clay' },
timestamp: { type: 'string', description: 'ISO timestamp when webhook was received' },
contentType: { type: 'string', description: 'Content type of the response' },
},
},
},
}

View File

@@ -9,5 +9,12 @@ export interface ClayPopulateParams {
export interface ClayPopulateResponse extends ToolResponse {
output: {
data: any
metadata: {
status: number
statusText: string
headers: Record<string, string>
timestamp: string
contentType: string
}
}
}