Skip to content

Commit f2067e2

Browse files
committed
feat(tools): add Presend email verify tool
1 parent e105e07 commit f2067e2

4 files changed

Lines changed: 116 additions & 0 deletions

File tree

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import type { PresendEmailVerifyParams, PresendEmailVerifyResponse } from '@/tools/presend/types'
2+
import type { ToolConfig } from '@/tools/types'
3+
4+
export const emailVerifyTool: ToolConfig<PresendEmailVerifyParams, PresendEmailVerifyResponse> = {
5+
id: 'presend_email_verify',
6+
name: 'Presend Email Verify',
7+
description:
8+
'Free, no-signup, no-key single-address email verification: syntax, MX record, disposable-domain, and role-account checks in one call.',
9+
version: '1.0.0',
10+
11+
params: {
12+
email: {
13+
type: 'string',
14+
required: true,
15+
visibility: 'user-or-llm',
16+
description: 'The email address to verify',
17+
},
18+
},
19+
20+
request: {
21+
url: (params) => {
22+
const url = new URL('https://presend.pages.dev/api/email-verify')
23+
url.searchParams.append('email', params.email)
24+
25+
return url.toString()
26+
},
27+
method: 'GET',
28+
headers: () => ({
29+
'Content-Type': 'application/json',
30+
}),
31+
},
32+
33+
transformResponse: async (response: Response) => {
34+
const data = await response.json()
35+
36+
return {
37+
success: true,
38+
output: {
39+
email: data?.email ?? '',
40+
valid: data?.valid ?? false,
41+
syntaxValid: data?.syntax_valid ?? false,
42+
domain: data?.domain ?? '',
43+
mxFound: data?.has_mx ?? false,
44+
mxCount: data?.mx_count ?? 0,
45+
disposable: data?.disposable ?? false,
46+
roleAccount: data?.role_account ?? false,
47+
reason: data?.reason ?? '',
48+
},
49+
}
50+
},
51+
52+
outputs: {
53+
email: {
54+
type: 'string',
55+
description: 'The verified email address',
56+
},
57+
valid: {
58+
type: 'boolean',
59+
description: 'Whether the email address is valid overall',
60+
},
61+
syntaxValid: {
62+
type: 'boolean',
63+
description: 'Whether the email address is correctly formatted (RFC syntax)',
64+
},
65+
domain: {
66+
type: 'string',
67+
description: 'The domain part of the email address',
68+
},
69+
mxFound: {
70+
type: 'boolean',
71+
description: "Whether the domain's MX records were found",
72+
},
73+
mxCount: {
74+
type: 'number',
75+
description: 'Number of MX records found for the domain',
76+
},
77+
disposable: {
78+
type: 'boolean',
79+
description: 'Whether the email uses a disposable/temporary domain',
80+
},
81+
roleAccount: {
82+
type: 'boolean',
83+
description: 'Whether the address is a role account (e.g. info@, support@)',
84+
},
85+
reason: {
86+
type: 'string',
87+
description: 'Explanation when the address is invalid, otherwise null',
88+
},
89+
},
90+
}

‎apps/sim/tools/presend/index.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { emailVerifyTool } from '@/tools/presend/email_verify'
2+
3+
export const presendEmailVerifyTool = emailVerifyTool

‎apps/sim/tools/presend/types.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Common types for Presend tools
2+
import type { ToolResponse } from '@/tools/types'
3+
4+
// Email Verify tool types
5+
export interface PresendEmailVerifyParams {
6+
email: string
7+
}
8+
9+
export interface PresendEmailVerifyResponse extends ToolResponse {
10+
output: {
11+
email: string
12+
valid: boolean
13+
syntaxValid: boolean
14+
domain: string
15+
mxFound: boolean
16+
mxCount: number
17+
disposable: boolean
18+
roleAccount: boolean
19+
reason: string
20+
}
21+
}

‎apps/sim/tools/registry.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3805,6 +3805,7 @@ import {
38053805
posthogUpdatePropertyDefinitionTool,
38063806
posthogUpdateSurveyTool,
38073807
} from '@/tools/posthog'
3808+
import { presendEmailVerifyTool } from '@/tools/presend'
38083809
import {
38093810
profoundBotLogsTool,
38103811
profoundBotsReportTool,
@@ -10847,6 +10848,7 @@ export const tools: Record<string, ExecutableToolConfig> = {
1084710848
hunter_email_verifier: hunterEmailVerifierTool,
1084810849
hunter_companies_find: hunterCompaniesFindTool,
1084910850
hunter_email_count: hunterEmailCountTool,
10851+
presend_email_verify: presendEmailVerifyTool,
1085010852
prospeo_account_information: prospeoAccountInformationTool,
1085110853
prospeo_enrich_person: prospeoEnrichPersonTool,
1085210854
prospeo_enrich_company: prospeoEnrichCompanyTool,

0 commit comments

Comments
 (0)