Docs
Email verification tool with the Anthropic API
Pass a tool definition to the Messages API, run verify_email when the model returns a tool_use block, and send the result back as a tool_result. SDK signatures change, so confirm them in Anthropic’s current documentation.
Tool definition
tools = [{
'name': 'verify_email',
'description': 'Check whether one email address can receive mail. status unknown means no conclusion, not invalid.',
'input_schema': {
'type': 'object',
'properties': {'email': {'type': 'string'}},
'required': ['email'],
},
}]Run the tool
# `message` is the assistant reply from client.messages.create(..., tools=tools)
results = []
for block in message.content:
if block.type == 'tool_use' and block.name == 'verify_email':
out = verify_email(block.input['email']) # see the AI tool pattern page
results.append({
'type': 'tool_result',
'tool_use_id': block.id,
'content': str(out),
})
# send results as the next user message, then call the API againNotes
Use a model name from Anthropic’s current list in your own configuration. Keep VALIDREACH_API_KEY on the server and cap tool calls per run.
Related