unified-llm-client
    Preparing search index...

    Function defineTool

    • Declares a tool while preserving TypeScript inference for its argument shape.

      Type Parameters

      Parameters

      Returns CanonicalTool<TArgs>

      const weather = defineTool({
      name: 'lookup_weather',
      description: 'Look up weather by city',
      parameters: {
      type: 'object',
      properties: {
      city: { type: 'string' },
      },
      required: ['city'],
      },
      async execute(args) {
      return { city: args.city, forecast: 'Sunny' };
      },
      });