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

Function tool

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

Source from the content-addressed store, hash-verified

463}
464
465export const tool = <
466 TStore = unknown,
467 TInputSchema extends StaticToolSchema | undefined = StaticToolSchema | undefined,
468>(
469 input: StaticToolInput<TStore, TInputSchema>,
470): StaticToolDecl<TStore> => ({
471 name: input.name,
472 description: input.description,
473 inputSchema: input.inputSchema,
474 outputSchema: input.outputSchema,
475 annotations: input.annotations,
476 handler: ({ args, ctx, elicit }) =>
477 decodeStaticToolArgs(input.inputSchema, args).pipe(
478 Effect.flatMap((decoded) =>
479 input.execute(
480 decoded as TInputSchema extends StaticToolSchema
481 ? StandardSchemaV1.InferOutput<TInputSchema>
482 : unknown,
483 { ctx, elicit },
484 ),
485 ),
486 ),
487});
488
489export interface StaticIntegrationDecl<TStore = unknown> {
490 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