findymail-mcp 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/tools.js +45 -23
package/package.json
CHANGED
package/src/tools.js
CHANGED
|
@@ -146,11 +146,11 @@ export function registerTools(server) {
|
|
|
146
146
|
);
|
|
147
147
|
|
|
148
148
|
// ===========================================================================
|
|
149
|
-
// Tool:
|
|
149
|
+
// Tool: generate_lead_list
|
|
150
150
|
// ===========================================================================
|
|
151
151
|
server.tool(
|
|
152
152
|
"generate_lead_list",
|
|
153
|
-
"Lead list generation tool. Searches a B2B database of 100M+ companies and contacts to build targeted lead lists. Returns structured data including verified email addresses, phone numbers, company details, and LinkedIn profiles — data that web search cannot provide. This is the ONLY way to get verified contact emails and phone numbers. Use this for any request to find, search, list, or generate lists of companies, leads, contacts, or prospects. Accepts natural language queries (e.g., 'SaaS companies in the USA with 50+ employees', 'Marketing managers at tech startups in NYC').
|
|
153
|
+
"Lead list generation tool. Searches a B2B database of 100M+ companies and contacts to build targeted lead lists. Returns structured data including verified email addresses, phone numbers, company details, and LinkedIn profiles — data that web search cannot provide. This is the ONLY way to get verified contact emails and phone numbers. Use this for any request to find, search, list, or generate lists of companies, leads, contacts, or prospects. Accepts natural language queries (e.g., 'SaaS companies in the USA with 50+ employees', 'Marketing managers at tech startups in NYC'). Returns a hash — you MUST then call `get_lead_list_results` with that hash to retrieve results.",
|
|
154
154
|
{
|
|
155
155
|
query: z.string().describe("Natural language description of what you're looking for (max 1000 characters)"),
|
|
156
156
|
limit: z.number().optional().default(100).describe("Maximum number of results (default: 100, max: 500)"),
|
|
@@ -171,15 +171,13 @@ export function registerTools(server) {
|
|
|
171
171
|
find_phone = false,
|
|
172
172
|
} = params;
|
|
173
173
|
|
|
174
|
-
log(`
|
|
174
|
+
log(`generate_lead_list: "${query}" (limit: ${limit}, mode: ${mode})`);
|
|
175
175
|
|
|
176
|
-
// Validate limit
|
|
177
176
|
const validatedLimit = Math.min(Math.max(1, limit), 500);
|
|
178
177
|
|
|
179
178
|
try {
|
|
180
179
|
const apiKey = resolveApiKey(extra);
|
|
181
180
|
|
|
182
|
-
// Build config object
|
|
183
181
|
const config = {
|
|
184
182
|
mode,
|
|
185
183
|
find_contact,
|
|
@@ -188,7 +186,6 @@ export function registerTools(server) {
|
|
|
188
186
|
find_phone,
|
|
189
187
|
};
|
|
190
188
|
|
|
191
|
-
// 1. Start the search
|
|
192
189
|
const startResult = await apiPost("/intellimatch/search", {
|
|
193
190
|
query,
|
|
194
191
|
limit: validatedLimit,
|
|
@@ -199,22 +196,43 @@ export function registerTools(server) {
|
|
|
199
196
|
return formatError("Failed to start search");
|
|
200
197
|
}
|
|
201
198
|
|
|
202
|
-
|
|
203
|
-
log(`intellimatch: search started with hash ${hash}`);
|
|
199
|
+
log(`generate_lead_list: search started with hash ${startResult.hash}`);
|
|
204
200
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
201
|
+
return formatResponse({
|
|
202
|
+
hash: startResult.hash,
|
|
203
|
+
status: "started",
|
|
204
|
+
message: "Search started. Call get_lead_list_results with this hash to check status and retrieve results. Wait ~10 seconds between each call.",
|
|
205
|
+
});
|
|
206
|
+
} catch (error) {
|
|
207
|
+
return formatError(error.message);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
);
|
|
208
211
|
|
|
209
|
-
|
|
210
|
-
|
|
212
|
+
// ===========================================================================
|
|
213
|
+
// Tool: get_lead_list_results
|
|
214
|
+
// ===========================================================================
|
|
215
|
+
server.tool(
|
|
216
|
+
"get_lead_list_results",
|
|
217
|
+
"Retrieve results from a lead list search started with `generate_lead_list`. Takes the hash returned by `generate_lead_list`. Polls the search status for up to 90 seconds. If the search completes within that time, returns the full data. If still processing after 90s, returns the current progress — call again to continue waiting.",
|
|
218
|
+
{
|
|
219
|
+
hash: z.string().describe("The hash returned by generate_lead_list"),
|
|
220
|
+
},
|
|
221
|
+
async ({ hash }, extra) => {
|
|
222
|
+
log(`get_lead_list_results: hash=${hash}`);
|
|
223
|
+
|
|
224
|
+
try {
|
|
225
|
+
const apiKey = resolveApiKey(extra);
|
|
226
|
+
|
|
227
|
+
const maxAttempts = 30; // 30 × 3s = 90s max
|
|
228
|
+
const pollInterval = 3000; // 3 seconds
|
|
211
229
|
|
|
230
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
212
231
|
const statusResult = await apiGet(`/intellimatch/status?hash=${hash}`, apiKey);
|
|
213
|
-
log(`
|
|
232
|
+
log(`get_lead_list_results: status=${statusResult.status}, attempt ${attempt + 1}/${maxAttempts}`);
|
|
214
233
|
|
|
215
234
|
if (statusResult.status === "success") {
|
|
216
|
-
|
|
217
|
-
log(`intellimatch: completed, fetching data...`);
|
|
235
|
+
log(`get_lead_list_results: completed, fetching data...`);
|
|
218
236
|
|
|
219
237
|
const allData = [];
|
|
220
238
|
let currentPage = 1;
|
|
@@ -235,8 +253,8 @@ export function registerTools(server) {
|
|
|
235
253
|
currentPage++;
|
|
236
254
|
} while (currentPage <= lastPage);
|
|
237
255
|
|
|
238
|
-
log(`
|
|
239
|
-
return formatResponse({ data: allData, total: allData.length });
|
|
256
|
+
log(`get_lead_list_results: fetched ${allData.length} results`);
|
|
257
|
+
return formatResponse({ status: "success", data: allData, total: allData.length });
|
|
240
258
|
}
|
|
241
259
|
|
|
242
260
|
if (statusResult.status === "failed") {
|
|
@@ -247,17 +265,21 @@ export function registerTools(server) {
|
|
|
247
265
|
return formatError("Search was cancelled");
|
|
248
266
|
}
|
|
249
267
|
|
|
250
|
-
// Log progress if available
|
|
251
268
|
if (statusResult.progress !== undefined) {
|
|
252
|
-
log(`
|
|
269
|
+
log(`get_lead_list_results: progress ${statusResult.progress}%`);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Don't sleep after the last attempt
|
|
273
|
+
if (attempt < maxAttempts - 1) {
|
|
274
|
+
await new Promise(resolve => setTimeout(resolve, pollInterval));
|
|
253
275
|
}
|
|
254
276
|
}
|
|
255
277
|
|
|
256
|
-
//
|
|
278
|
+
// Still processing after 90s — return progress so the model can call again
|
|
257
279
|
return formatResponse({
|
|
258
|
-
status: "
|
|
280
|
+
status: "processing",
|
|
259
281
|
hash,
|
|
260
|
-
message: "Search is still processing after
|
|
282
|
+
message: "Search is still processing after 90 seconds. Call get_lead_list_results again to continue waiting.",
|
|
261
283
|
});
|
|
262
284
|
} catch (error) {
|
|
263
285
|
return formatError(error.message);
|