MCPcopy Create free account
hub / github.com/Effect-TS/effect / dynamicProto

Function dynamicProto

packages/effect/src/unstable/ai/Tool.ts:1145–1173  ·  view source on GitHub ↗
(options: {
  readonly name: Name
  readonly description?: string | undefined
  readonly parametersSchema: Parameters
  readonly successSchema: Success
  readonly failureSchema: Failure
  readonly annotations: Context.Context<never>
  readonly failureMode: Mode
  readonly needsApproval?: NeedsApproval<any> | undefined
  readonly jsonSchema: JsonSchema.JsonSchema | undefined
})

Source from the content-addressed store, hash-verified

1143> => Object.assign(Object.create(ProviderDefinedProto), { annotations: Context.empty(), ...options })
1144
1145const dynamicProto = <
1146 const Name extends string,
1147 Parameters extends Schema.Constraint | JsonSchema.JsonSchema,
1148 Success extends Schema.Constraint,
1149 Failure extends Schema.Constraint,
1150 Mode extends FailureMode
1151>(options: {
1152 readonly name: Name
1153 readonly description?: string | undefined
1154 readonly parametersSchema: Parameters
1155 readonly successSchema: Success
1156 readonly failureSchema: Failure
1157 readonly annotations: Context.Context<never>
1158 readonly failureMode: Mode
1159 readonly needsApproval?: NeedsApproval<any> | undefined
1160 readonly jsonSchema: JsonSchema.JsonSchema | undefined
1161}): Dynamic<
1162 Name,
1163 {
1164 readonly parameters: Parameters
1165 readonly success: Success
1166 readonly failure: Failure
1167 readonly failureMode: Mode
1168 }
1169> => {
1170 const self = Object.assign(Object.create(DynamicProto), options)
1171 self.id = `effect/ai/Tool/${options.name}`
1172 return self
1173}
1174
1175/**
1176 * Creates a user-defined tool with the specified name and configuration.

Callers 1

dynamicFunction · 0.85

Calls 1

assignMethod · 0.80

Tested by

no test coverage detected