handler: async()

in src/utils/initExtraTools.ts [84:108]


      handler: async (agent, input) => {
        try {
          const { DateTimeDisplay } = input;
          const response = await toTimestamps(agent, DateTimeDisplay);
          return response as any;
        } catch (error: any) {
          // Handle specific Perplexity API error types
          if (error.response) {
            const { status, data } = error.response;
            if (status === 429) {
              return {
                statusCode: status,
                body: "Error: Rate limit exceeded. Please try again later.",
              };
            }
            return {
              statusCode: status,
              body: `Error: ${data.error?.message || error.message}`,
            };
          }
          return {
            body: `Failed to get information: ${error.message}`,
          };
        }
      }