Skip to main content
Glama
luiso2

Evolution API WhatsApp MCP Server

by luiso2

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceNameYesInstance name
numbersYesPhone numbers to check

Implementation Reference

  • 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)
          }
        ]
      };
    }
  • 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;
    }
  • 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 });
      }
    });

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.4/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description does not disclose any behavioral traits such as required instance state, return format, rate limits, or side effects. This is a severe gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, which is concise but lacks structure and additional helpful information. It is minimally acceptable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with two simple parameters and no output schema, the description is critically incomplete. It fails to explain the output, behavioral expectations, or any edge cases, leaving the agent with insufficient context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already defines both parameters. The description adds no additional meaning beyond what the schema provides, meriting the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Check if phone numbers have WhatsApp' uses a specific verb and resource, clearly indicating the action. However, it does not differentiate from sibling tools such as get_chats or list_contacts, which also deal with contacts.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives or when not to use it. The description is too minimal to help an agent decide context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.