import { apiClient } from "../lib/apiClient.js";
export async function runWebHarvestTool(args: any) {
try {
const { searchQuery, location, limit = 10 } = args;
if (!searchQuery || !location) {
throw new Error("searchQuery and location are required parameters");
}
const result = await apiClient.runWebHarvest({
searchQuery,
location,
limit,
});
return {
content: [
{
type: "text",
text: JSON.stringify(result, null, 2),
},
],
};
} catch (error: any) {
const errorMessage =
error.response?.data?.error || error.message || "Unknown error occurred";
return {
content: [
{
type: "text",
text: `Error running web harvest: ${errorMessage}`,
},
],
isError: true,
};
}
}