Files
wehub-resource-sync d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

147 lines
4.4 KiB
TypeScript

import type { HunterEmailVerifierParams, HunterEmailVerifierResponse } from '@/tools/hunter/types'
import {
HUNTER_API_KEY_PREFIX,
HUNTER_VERIFICATION_CREDIT_USD,
SOURCES_OUTPUT,
} from '@/tools/hunter/types'
import type { ToolConfig } from '@/tools/types'
export const emailVerifierTool: ToolConfig<HunterEmailVerifierParams, HunterEmailVerifierResponse> =
{
id: 'hunter_email_verifier',
name: 'Hunter Email Verifier',
description:
'Verifies the deliverability of an email address and provides detailed verification status.',
version: '1.0.0',
hosting: {
envKeyPrefix: HUNTER_API_KEY_PREFIX,
apiKeyParam: 'apiKey',
byokProviderId: 'hunter',
pricing: {
type: 'custom',
// The verifier always consumes one verification (0.5 credit), regardless of result.
getCost: () => ({
cost: HUNTER_VERIFICATION_CREDIT_USD,
metadata: { verifications: 1 },
}),
},
rateLimit: {
mode: 'per_request',
requestsPerMinute: 60,
},
},
params: {
email: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The email address to verify',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Hunter.io API Key',
},
},
request: {
url: (params) => {
const url = new URL('https://api.hunter.io/v2/email-verifier')
url.searchParams.append('email', params.email)
url.searchParams.append('api_key', params.apiKey)
return url.toString()
},
method: 'GET',
headers: () => ({
'Content-Type': 'application/json',
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
result: data.data?.result || 'unknown',
score: data.data?.score || 0,
email: data.data?.email || '',
regexp: data.data?.regexp || false,
gibberish: data.data?.gibberish || false,
disposable: data.data?.disposable || false,
webmail: data.data?.webmail || false,
mx_records: data.data?.mx_records || false,
smtp_server: data.data?.smtp_server || false,
smtp_check: data.data?.smtp_check || false,
accept_all: data.data?.accept_all || false,
block: data.data?.block || false,
status: data.data?.status || 'unknown',
sources: data.data?.sources || [],
},
}
},
outputs: {
result: {
type: 'string',
description: 'Deliverability result: deliverable, undeliverable, or risky',
},
score: {
type: 'number',
description:
'Deliverability score (0-100). Webmail and disposable emails receive an arbitrary score of 50.',
},
email: {
type: 'string',
description: 'The verified email address',
},
regexp: {
type: 'boolean',
description: 'Whether the email passes regular expression validation',
},
gibberish: {
type: 'boolean',
description: 'Whether the email appears to be auto-generated (e.g., e65rc109q@company.com)',
},
disposable: {
type: 'boolean',
description: 'Whether the email is from a disposable email service',
},
webmail: {
type: 'boolean',
description: 'Whether the email is from a webmail provider (e.g., Gmail)',
},
mx_records: {
type: 'boolean',
description: 'Whether MX records exist for the domain',
},
smtp_server: {
type: 'boolean',
description: 'Whether connection to the SMTP server was successful',
},
smtp_check: {
type: 'boolean',
description: "Whether the email address doesn't bounce",
},
accept_all: {
type: 'boolean',
description: 'Whether the server accepts all email addresses (may cause false positives)',
},
block: {
type: 'boolean',
description:
'Whether the domain is blocking verification (validity could not be determined)',
},
status: {
type: 'string',
description:
'Verification status: valid, invalid, accept_all, webmail, disposable, unknown, or blocked',
},
sources: SOURCES_OUTPUT,
},
}