(name: Name, options?: Options)
| 1352 | } |
| 1353 | > |
| 1354 | } = < |
| 1355 | const Name extends string, |
| 1356 | const Options extends { |
| 1357 | readonly description?: string | undefined |
| 1358 | readonly parameters?: Schema.Constraint | JsonSchema.JsonSchema | undefined |
| 1359 | readonly success?: Schema.Constraint | undefined |
| 1360 | readonly failure?: Schema.Constraint | undefined |
| 1361 | readonly failureMode?: FailureMode | undefined |
| 1362 | readonly needsApproval?: NeedsApproval<any> | undefined |
| 1363 | } |
| 1364 | >(name: Name, options?: Options): any => { |
| 1365 | const successSchema = options?.success ?? Schema.Unknown |
| 1366 | const failureSchema = options?.failure ?? Schema.Never |
| 1367 | const rawParameters = options?.parameters ?? Schema.Unknown |
| 1368 | const isEffectSchema = Schema.isSchema(rawParameters) |
| 1369 | const parametersSchema = isEffectSchema ? rawParameters : Schema.Unknown |
| 1370 | const jsonSchema = isEffectSchema ? undefined : rawParameters as JsonSchema.JsonSchema |
| 1371 | return dynamicProto({ |
| 1372 | name, |
| 1373 | description: options?.description, |
| 1374 | parametersSchema, |
| 1375 | successSchema, |
| 1376 | failureSchema, |
| 1377 | failureMode: options?.failureMode ?? "error", |
| 1378 | annotations: Context.empty(), |
| 1379 | needsApproval: options?.needsApproval, |
| 1380 | jsonSchema |
| 1381 | }) |
| 1382 | } |
| 1383 | |
| 1384 | /** |
| 1385 | * Creates a provider-defined tool which leverages functionality built into a |
nothing calls this directly
no test coverage detected