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

Function tool

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

Source from the content-addressed store, hash-verified

499}
500
501export const tool = <
502 TStore = unknown,
503 TInputSchema extends StaticToolSchema | undefined = StaticToolSchema | undefined,
504>(
505 input: StaticToolInput<TStore, TInputSchema>,
506): StaticToolDecl<TStore> => ({
507 name: input.name,
508 description: input.description,
509 inputSchema: input.inputSchema,
510 outputSchema: input.outputSchema,
511 annotations: input.annotations,
512 handler: ({ args, ctx, elicit }) =>
513 decodeStaticToolArgs(input.inputSchema, args).pipe(
514 Effect.flatMap((decoded) =>
515 input.execute(
516 decoded as TInputSchema extends StaticToolSchema
517 ? StandardSchemaV1.InferOutput<TInputSchema>
518 : unknown,
519 { ctx, elicit },
520 ),
521 ),
522 ),
523});
524
525export interface StaticIntegrationDecl<TStore = unknown> {
526 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