check_number
Verify phone numbers to determine WhatsApp account status for business messaging, ensuring messages reach valid contacts.
Instructions
Check if phone numbers have WhatsApp
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"instanceName": "<instanceName>",
"numbers": "<numbers>"
},
"name": "check_number"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instanceName | Yes | Instance name | |
| numbers | Yes | Phone numbers to check |
Implementation Reference
- src/index.ts:869-879 (handler)The primary MCP tool handler for 'check_number'. It calls the EvolutionAPI service to check WhatsApp status for given phone numbers and returns the result as formatted JSON text.
private async handleCheckNumber(args: any) { const result = await evolutionAPI.checkNumberStatus(args.instanceName, args.numbers); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; } - src/index.ts:318-333 (schema)Tool definition including name, description, and input schema for validation.
{ name: 'check_number', description: 'Check if phone numbers have WhatsApp', inputSchema: { type: 'object', properties: { instanceName: { type: 'string', description: 'Instance name' }, numbers: { type: 'array', items: { type: 'string' }, description: 'Phone numbers to check' } }, required: ['instanceName', 'numbers'] } }, - src/index.ts:526-527 (registration)Registration of the tool handler in the MCP call tool request switch statement.
case 'check_number': return await this.handleCheckNumber(args); - Supporting method in EvolutionAPI service that makes the actual HTTP POST request to the backend API endpoint /chat/checkNumberStatus/{instanceName} to check number statuses.
async checkNumberStatus(instanceName: string, numbers: string[]): Promise<any[]> { const response = await this.client.post(`/chat/checkNumberStatus/${instanceName}`, { numbers }); return response.data; } - src/routes/api.ts:294-312 (helper)HTTP API route handler for checking numbers (POST /check-numbers), which cleans numbers and calls the same EvolutionAPI method. Related but separate from MCP tool.
router.post('/check-numbers', async (req, res) => { try { const { instanceName, numbers } = req.body; if (!instanceName || !numbers || !Array.isArray(numbers)) { res.status(400).json({ error: 'Missing required fields: instanceName, numbers (array)' }); return; } const cleanNumbers = numbers.map(n => n.replace(/[\s\-\+\(\)]/g, '')); const result = await evolutionAPI.checkNumberStatus(instanceName, cleanNumbers); res.json(result); } catch (error: any) { res.status(500).json({ error: error.message }); } });