DAFT - v1.0.0
    Preparing search index...

    Function defineTool

    • Define a tool with proper TypeScript types.

      This is a type-safe helper for creating tools. The function preserves the input/output types from the config.

      Type Parameters

      • I

        Input type for the tool

      • O

        Output type for the tool

      Parameters

      Returns Tool<I, O>

      A fully-typed Tool object

      const myTool = defineTool({
      name: 'summarize',
      input: {} as { text: string },
      output: {} as { summary: string },
      description: 'Summarize text',
      run: async (input) => {
      return { output: { summary: input.text.substring(0, 50) } };
      }
      });