MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / tool

Function tool

packages/core/sdk/src/plugin.ts:409–431  ·  view source on GitHub ↗
(
  input: StaticToolInput<TStore, TInputSchema>,
)

Source from the content-addressed store, hash-verified

407}
408
409export const tool = <
410 TStore = unknown,
411 TInputSchema extends StaticToolSchema | undefined = StaticToolSchema | undefined,
412>(
413 input: StaticToolInput<TStore, TInputSchema>,
414): StaticToolDecl<TStore> => ({
415 name: input.name,
416 description: input.description,
417 inputSchema: input.inputSchema,
418 outputSchema: input.outputSchema,
419 annotations: input.annotations,
420 handler: ({ args, ctx, elicit }) =>
421 decodeStaticToolArgs(input.inputSchema, args).pipe(
422 Effect.flatMap((decoded) =>
423 input.execute(
424 decoded as TInputSchema extends StaticToolSchema
425 ? StandardSchemaV1.InferOutput<TInputSchema>
426 : unknown,
427 { ctx, elicit },
428 ),
429 ),
430 ),
431});
432
433export interface StaticSourceDecl<TStore = unknown> {
434 readonly id: string;

Callers 7

promise.test.tsFile · 0.90
core-tools.tsFile · 0.90
policies.test.tsFile · 0.90
server.tsFile · 0.90
plugin.tsFile · 0.90
plugin.tsFile · 0.90
plugin.tsFile · 0.90

Calls 2

decodeStaticToolArgsFunction · 0.85
executeMethod · 0.65

Tested by

no test coverage detected