// Define a new tool in app/actions/ai/index.ts
export const agentTools = {
// Existing tools...
weather: {
description: "Get current weather information",
parameters: {
type: "object",
properties: {
location: {
type: "string",
description: "The city and state, e.g. San Francisco, CA"
}
},
required: ["location"]
}
}
};
// Implement the tool handler
// In app/actions/ai/tools/weather.ts
export async function handleWeatherTool(args: { location: string }) {
// Fetch weather data from an API
const weatherData = await fetchWeatherData(args.location);
return weatherData;
}