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

Function tool

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

Source from the content-addressed store, hash-verified

531}
532
533export const tool = <
534 TStore = unknown,
535 TInputSchema extends StaticToolSchema | undefined = StaticToolSchema | undefined,
536>(
537 input: StaticToolInput<TStore, TInputSchema>,
538): StaticToolDecl<TStore> => ({
539 name: input.name,
540 description: input.description,
541 inputSchema: input.inputSchema,
542 outputSchema: input.outputSchema,
543 annotations: input.annotations,
544 handler: ({ args, ctx, elicit }) =>
545 decodeStaticToolArgs(input.inputSchema, args).pipe(
546 Effect.flatMap((decoded) =>
547 input.execute(
548 decoded as TInputSchema extends StaticToolSchema
549 ? StandardSchemaV1.InferOutput<TInputSchema>
550 : unknown,
551 { ctx, elicit },
552 ),
553 ),
554 ),
555});
556
557export interface StaticIntegrationDecl<TStore = unknown> {
558 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