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

Function tool

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

Source from the content-addressed store, hash-verified

518}
519
520export const tool = <
521 TStore = unknown,
522 TInputSchema extends StaticToolSchema | undefined = StaticToolSchema | undefined,
523>(
524 input: StaticToolInput<TStore, TInputSchema>,
525): StaticToolDecl<TStore> => ({
526 name: input.name,
527 description: input.description,
528 inputSchema: input.inputSchema,
529 outputSchema: input.outputSchema,
530 annotations: input.annotations,
531 handler: ({ args, ctx, elicit }) =>
532 decodeStaticToolArgs(input.inputSchema, args).pipe(
533 Effect.flatMap((decoded) =>
534 input.execute(
535 decoded as TInputSchema extends StaticToolSchema
536 ? StandardSchemaV1.InferOutput<TInputSchema>
537 : unknown,
538 { ctx, elicit },
539 ),
540 ),
541 ),
542});
543
544export interface StaticIntegrationDecl<TStore = unknown> {
545 readonly id: string;

Callers 8

promise.test.tsFile · 0.90
core-tools.tsFile · 0.90
policies.test.tsFile · 0.90
engine.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