Files
sim/tools/types.ts
2025-02-03 21:56:27 -08:00

36 lines
1.0 KiB
TypeScript

export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
export interface ToolResponse {
success: boolean // Whether the tool execution was successful
output: Record<string, any> // The structured output from the tool
error?: string // Error message if success is false
}
export interface ToolConfig<P = any, R extends ToolResponse = ToolResponse> {
// Basic tool identification
id: string
name: string
description: string
version: string
// Parameter schema - what this tool accepts
params: Record<string, {
type: string
required?: boolean
requiredForToolCall?: boolean
default?: any
description?: string
}>
// Request configuration
request: {
url: string | ((params: P) => string)
method: string
headers: (params: P) => Record<string, string>
body?: (params: P) => Record<string, any>
}
// Response handling
transformResponse: (response: Response) => Promise<R>
transformError: (error: any) => string
}