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

Function tool

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

Source from the content-addressed store, hash-verified

482}
483
484export const tool = <
485 TStore = unknown,
486 TInputSchema extends StaticToolSchema | undefined = StaticToolSchema | undefined,
487>(
488 input: StaticToolInput<TStore, TInputSchema>,
489): StaticToolDecl<TStore> => ({
490 name: input.name,
491 description: input.description,
492 inputSchema: input.inputSchema,
493 outputSchema: input.outputSchema,
494 annotations: input.annotations,
495 handler: ({ args, ctx, elicit }) =>
496 decodeStaticToolArgs(input.inputSchema, args).pipe(
497 Effect.flatMap((decoded) =>
498 input.execute(
499 decoded as TInputSchema extends StaticToolSchema
500 ? StandardSchemaV1.InferOutput<TInputSchema>
501 : unknown,
502 { ctx, elicit },
503 ),
504 ),
505 ),
506});
507
508export interface StaticIntegrationDecl<TStore = unknown> {
509 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