send_sms
Send outbound SMS messages from a provisioned phone number to any recipient in E.164 format. Supports US and international SMS with approved 10DLC campaign for major carriers. Includes inbound SMS capability for two-way communication.
Instructions
Send an outbound SMS from a provisioned number. from_number must be a
number you already provisioned; to_number is the recipient in E.164 format
(e.g. "+15551234567"). Outbound US SMS, international SMS, and inbound SMS
all work — Agentline's 10DLC campaign is approved across all major US carriers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_number | Yes | ||
| to_number | Yes | ||
| body | Yes |
Implementation Reference
- agentline_mcp/server.py:119-129 (handler)The send_sms tool handler: an MCP tool decorated with @mcp.tool() that sends an outbound SMS. Takes from_number, to_number, and body parameters. Calls the Agentline SDK's send_sms() and returns the result, or error/status_code on failure.
@mcp.tool() def send_sms(from_number: str, to_number: str, body: str) -> dict: """Send an outbound SMS from a provisioned number. `from_number` must be a number you already provisioned; `to_number` is the recipient in E.164 format (e.g. "+15551234567"). Outbound US SMS, international SMS, and inbound SMS all work — Agentline's 10DLC campaign is approved across all major US carriers. """ try: return _client_or_init().send_sms(from_=from_number, to=to_number, body=body) except AgentlineError as e: return {"error": str(e), "status_code": e.status_code} - agentline_mcp/server.py:119-119 (registration)The send_sms tool is registered via the @mcp.tool() decorator on line 119. The mcp object is a FastMCP instance created on line 47.
@mcp.tool() - agentline_mcp/server.py:30-44 (helper)_build_client() creates the Agentline SDK client used by send_sms. Reads AGENTLINE_API_KEY and optional AGENTLINE_BASE_URL from environment.
def _build_client() -> Agentline: api_key = os.environ.get("AGENTLINE_API_KEY", "").strip() if not api_key: print( "AGENTLINE_API_KEY is not set. Get a key at https://www.agentline.co " "and export it before running this server.", file=sys.stderr, ) sys.exit(1) base_url = os.environ.get("AGENTLINE_BASE_URL", "").strip() or None kwargs: dict[str, Any] = {"api_key": api_key} if base_url: kwargs["base_url"] = base_url return Agentline(**kwargs) - agentline_mcp/server.py:51-55 (helper)_client_or_init() is a lazy singleton getter for the Agentline client, used by send_sms (and all other tools) to get the SDK client instance.
def _client_or_init() -> Agentline: global _client if _client is None: _client = _build_client() return _client