Make server tool http based
This commit is contained in:
@@ -102,6 +102,10 @@ const mapTool = (raw: AnyRecord): Tool => ({
|
||||
description: readField(raw, ['description'], ''),
|
||||
category: readField(raw, ['category'], 'system') as 'system' | 'query',
|
||||
icon: readField(raw, ['icon'], 'Wrench'),
|
||||
httpMethod: readField(raw, ['httpMethod', 'http_method'], 'GET') as Tool['httpMethod'],
|
||||
httpUrl: readField(raw, ['httpUrl', 'http_url'], ''),
|
||||
httpHeaders: readField(raw, ['httpHeaders', 'http_headers'], {}),
|
||||
httpTimeoutMs: Number(readField(raw, ['httpTimeoutMs', 'http_timeout_ms'], 10000)),
|
||||
isSystem: Boolean(readField(raw, ['isSystem', 'is_system'], false)),
|
||||
enabled: Boolean(readField(raw, ['enabled'], true)),
|
||||
isCustom: !Boolean(readField(raw, ['isSystem', 'is_system'], false)),
|
||||
@@ -500,6 +504,10 @@ export const createTool = async (data: Partial<Tool>): Promise<Tool> => {
|
||||
description: data.description || '',
|
||||
category: data.category || 'system',
|
||||
icon: data.icon || (data.category === 'query' ? 'Globe' : 'Terminal'),
|
||||
http_method: data.httpMethod || 'GET',
|
||||
http_url: data.httpUrl || null,
|
||||
http_headers: data.httpHeaders || {},
|
||||
http_timeout_ms: data.httpTimeoutMs ?? 10000,
|
||||
enabled: data.enabled ?? true,
|
||||
};
|
||||
const response = await apiRequest<AnyRecord>('/tools/resources', { method: 'POST', body: payload });
|
||||
@@ -512,6 +520,10 @@ export const updateTool = async (id: string, data: Partial<Tool>): Promise<Tool>
|
||||
description: data.description,
|
||||
category: data.category,
|
||||
icon: data.icon,
|
||||
http_method: data.httpMethod,
|
||||
http_url: data.httpUrl,
|
||||
http_headers: data.httpHeaders,
|
||||
http_timeout_ms: data.httpTimeoutMs,
|
||||
enabled: data.enabled,
|
||||
};
|
||||
const response = await apiRequest<AnyRecord>(`/tools/resources/${id}`, { method: 'PUT', body: payload });
|
||||
|
||||
Reference in New Issue
Block a user