telnyx-mcp-server-fastmcp 0.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- telnyx_mcp_server/__init__.py +0 -0
- telnyx_mcp_server/__main__.py +23 -0
- telnyx_mcp_server/config.py +148 -0
- telnyx_mcp_server/mcp.py +148 -0
- telnyx_mcp_server/server.py +497 -0
- telnyx_mcp_server/telnyx/__init__.py +1 -0
- telnyx_mcp_server/telnyx/client.py +363 -0
- telnyx_mcp_server/telnyx/services/__init__.py +0 -0
- telnyx_mcp_server/telnyx/services/assistants.py +155 -0
- telnyx_mcp_server/telnyx/services/call_control.py +217 -0
- telnyx_mcp_server/telnyx/services/cloud_storage.py +289 -0
- telnyx_mcp_server/telnyx/services/connections.py +92 -0
- telnyx_mcp_server/telnyx/services/embeddings.py +52 -0
- telnyx_mcp_server/telnyx/services/messaging.py +93 -0
- telnyx_mcp_server/telnyx/services/messaging_profiles.py +196 -0
- telnyx_mcp_server/telnyx/services/numbers.py +193 -0
- telnyx_mcp_server/telnyx/services/secrets.py +74 -0
- telnyx_mcp_server/tools/__init__.py +126 -0
- telnyx_mcp_server/tools/assistants.py +313 -0
- telnyx_mcp_server/tools/call_control.py +242 -0
- telnyx_mcp_server/tools/cloud_storage.py +183 -0
- telnyx_mcp_server/tools/connections.py +78 -0
- telnyx_mcp_server/tools/embeddings.py +80 -0
- telnyx_mcp_server/tools/messaging.py +57 -0
- telnyx_mcp_server/tools/messaging_profiles.py +123 -0
- telnyx_mcp_server/tools/phone_numbers.py +161 -0
- telnyx_mcp_server/tools/secrets.py +75 -0
- telnyx_mcp_server/tools/sms_conversations.py +455 -0
- telnyx_mcp_server/tools/webhooks.py +111 -0
- telnyx_mcp_server/utils/__init__.py +0 -0
- telnyx_mcp_server/utils/error_handler.py +30 -0
- telnyx_mcp_server/utils/logger.py +32 -0
- telnyx_mcp_server/utils/service.py +33 -0
- telnyx_mcp_server/webhook/__init__.py +25 -0
- telnyx_mcp_server/webhook/handler.py +596 -0
- telnyx_mcp_server/webhook/server.py +369 -0
- telnyx_mcp_server_fastmcp-0.1.3.dist-info/METADATA +430 -0
- telnyx_mcp_server_fastmcp-0.1.3.dist-info/RECORD +40 -0
- telnyx_mcp_server_fastmcp-0.1.3.dist-info/WHEEL +4 -0
- telnyx_mcp_server_fastmcp-0.1.3.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Telnyx messaging service."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Optional
|
|
4
|
+
|
|
5
|
+
from ...utils.logger import get_logger
|
|
6
|
+
from ..client import TelnyxClient
|
|
7
|
+
|
|
8
|
+
logger = get_logger(__name__)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MessagingService:
|
|
12
|
+
"""Telnyx messaging service."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, client: Optional[TelnyxClient] = None):
|
|
15
|
+
"""Initialize the service.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
client: Telnyx API client (creates a new one if not provided)
|
|
19
|
+
"""
|
|
20
|
+
self.client = client or TelnyxClient()
|
|
21
|
+
|
|
22
|
+
def send_message(
|
|
23
|
+
self,
|
|
24
|
+
from_: str,
|
|
25
|
+
to: str,
|
|
26
|
+
text: str,
|
|
27
|
+
messaging_profile_id: Optional[str] = None,
|
|
28
|
+
subject: Optional[str] = None,
|
|
29
|
+
media_urls: Optional[List[str]] = None,
|
|
30
|
+
webhook_url: Optional[str] = None,
|
|
31
|
+
webhook_failover_url: Optional[str] = None,
|
|
32
|
+
use_profile_webhooks: bool = True,
|
|
33
|
+
type: Optional[str] = None,
|
|
34
|
+
auto_detect: Optional[bool] = None,
|
|
35
|
+
) -> Dict[str, Any]:
|
|
36
|
+
"""Send a message.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
from_: Sending address (phone number, alphanumeric sender ID, or short code)
|
|
40
|
+
to: Receiving address(es)
|
|
41
|
+
text: Message text
|
|
42
|
+
messaging_profile_id: Messaging profile ID
|
|
43
|
+
subject: Message subject
|
|
44
|
+
media_urls: Media URLs
|
|
45
|
+
webhook_url: Webhook URL
|
|
46
|
+
webhook_failover_url: Webhook failover URL
|
|
47
|
+
use_profile_webhooks: Whether to use profile webhooks
|
|
48
|
+
type: The protocol for sending the message, either SMS or MMS
|
|
49
|
+
auto_detect: Automatically detect if an SMS message is unusually long
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
Dict[str, Any]: Response data
|
|
53
|
+
"""
|
|
54
|
+
data = {
|
|
55
|
+
"from": from_,
|
|
56
|
+
"to": to if isinstance(to, list) else [to],
|
|
57
|
+
"text": text,
|
|
58
|
+
"use_profile_webhooks": use_profile_webhooks,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if messaging_profile_id:
|
|
62
|
+
data["messaging_profile_id"] = messaging_profile_id
|
|
63
|
+
|
|
64
|
+
if subject:
|
|
65
|
+
data["subject"] = subject
|
|
66
|
+
|
|
67
|
+
if media_urls:
|
|
68
|
+
data["media_urls"] = media_urls
|
|
69
|
+
|
|
70
|
+
if webhook_url:
|
|
71
|
+
data["webhook_url"] = webhook_url
|
|
72
|
+
|
|
73
|
+
if webhook_failover_url:
|
|
74
|
+
data["webhook_failover_url"] = webhook_failover_url
|
|
75
|
+
|
|
76
|
+
if type:
|
|
77
|
+
data["type"] = type
|
|
78
|
+
|
|
79
|
+
if auto_detect is not None:
|
|
80
|
+
data["auto_detect"] = auto_detect
|
|
81
|
+
|
|
82
|
+
return self.client.post("messages", data=data)
|
|
83
|
+
|
|
84
|
+
def get_message(self, message_id: str) -> Dict[str, Any]:
|
|
85
|
+
"""Retrieve a message by ID.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
message_id: The ID of the message to retrieve
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
Dict[str, Any]: Response data containing message details
|
|
92
|
+
"""
|
|
93
|
+
return self.client.get(f"messages/{message_id}")
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"""Telnyx messaging profiles service."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Optional
|
|
4
|
+
|
|
5
|
+
from ...utils.logger import get_logger
|
|
6
|
+
from ..client import TelnyxClient
|
|
7
|
+
|
|
8
|
+
logger = get_logger(__name__)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MessagingProfilesService:
|
|
12
|
+
"""Telnyx messaging profiles service."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, client: Optional[TelnyxClient] = None):
|
|
15
|
+
"""Initialize the service.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
client: Telnyx API client (creates a new one if not provided)
|
|
19
|
+
"""
|
|
20
|
+
self.client = client or TelnyxClient()
|
|
21
|
+
|
|
22
|
+
def list_messaging_profiles(
|
|
23
|
+
self,
|
|
24
|
+
page: Optional[int] = None,
|
|
25
|
+
page_size: Optional[int] = None,
|
|
26
|
+
filter_name: Optional[str] = None,
|
|
27
|
+
) -> Dict[str, Any]:
|
|
28
|
+
"""List messaging profiles.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
page: The page number to load
|
|
32
|
+
page_size: The size of the page
|
|
33
|
+
filter_name: Filter by name
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
Dict[str, Any]: Response data containing list of messaging profiles
|
|
37
|
+
"""
|
|
38
|
+
params = {}
|
|
39
|
+
if page is not None:
|
|
40
|
+
params["page[number]"] = page
|
|
41
|
+
if page_size is not None:
|
|
42
|
+
params["page[size]"] = page_size
|
|
43
|
+
if filter_name is not None:
|
|
44
|
+
params["filter[name]"] = filter_name
|
|
45
|
+
|
|
46
|
+
return self.client.get("messaging_profiles", params=params)
|
|
47
|
+
|
|
48
|
+
def create_messaging_profile(
|
|
49
|
+
self,
|
|
50
|
+
name: str,
|
|
51
|
+
whitelisted_destinations: List[str],
|
|
52
|
+
enabled: Optional[bool] = None,
|
|
53
|
+
webhook_url: Optional[str] = None,
|
|
54
|
+
webhook_failover_url: Optional[str] = None,
|
|
55
|
+
webhook_api_version: Optional[str] = None,
|
|
56
|
+
number_pool_settings: Optional[dict] = None,
|
|
57
|
+
url_shortener_settings: Optional[dict] = None,
|
|
58
|
+
alpha_sender: Optional[str] = None,
|
|
59
|
+
daily_spend_limit: Optional[str] = None,
|
|
60
|
+
daily_spend_limit_enabled: Optional[bool] = None,
|
|
61
|
+
mms_fall_back_to_sms: Optional[bool] = None,
|
|
62
|
+
mms_transcoding: Optional[bool] = None,
|
|
63
|
+
) -> Dict[str, Any]:
|
|
64
|
+
"""Create a messaging profile.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
name: A user friendly name for the messaging profile
|
|
68
|
+
whitelisted_destinations: Destinations to which the messaging profile is allowed to send
|
|
69
|
+
enabled: Specifies whether the messaging profile is enabled or not
|
|
70
|
+
webhook_url: The URL where webhooks related to this messaging profile will be sent
|
|
71
|
+
webhook_failover_url: The failover URL where webhooks related to this messaging profile will be sent
|
|
72
|
+
webhook_api_version: Determines which webhook format will be used
|
|
73
|
+
number_pool_settings: Number Pool settings
|
|
74
|
+
url_shortener_settings: URL shortener settings
|
|
75
|
+
alpha_sender: The alphanumeric sender ID
|
|
76
|
+
daily_spend_limit: The maximum amount of money that can be spent
|
|
77
|
+
daily_spend_limit_enabled: Whether to enforce the daily spend limit
|
|
78
|
+
mms_fall_back_to_sms: Enables SMS fallback for MMS messages
|
|
79
|
+
mms_transcoding: Enables automated resizing of MMS media
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
Dict[str, Any]: Response data containing the created messaging profile
|
|
83
|
+
"""
|
|
84
|
+
data = {
|
|
85
|
+
"name": name,
|
|
86
|
+
"whitelisted_destinations": whitelisted_destinations,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if enabled is not None:
|
|
90
|
+
data["enabled"] = enabled
|
|
91
|
+
if webhook_url is not None:
|
|
92
|
+
data["webhook_url"] = webhook_url
|
|
93
|
+
if webhook_failover_url is not None:
|
|
94
|
+
data["webhook_failover_url"] = webhook_failover_url
|
|
95
|
+
if webhook_api_version is not None:
|
|
96
|
+
data["webhook_api_version"] = webhook_api_version
|
|
97
|
+
if number_pool_settings is not None:
|
|
98
|
+
data["number_pool_settings"] = number_pool_settings
|
|
99
|
+
if url_shortener_settings is not None:
|
|
100
|
+
data["url_shortener_settings"] = url_shortener_settings
|
|
101
|
+
if alpha_sender is not None:
|
|
102
|
+
data["alpha_sender"] = alpha_sender
|
|
103
|
+
if daily_spend_limit is not None:
|
|
104
|
+
data["daily_spend_limit"] = daily_spend_limit
|
|
105
|
+
if daily_spend_limit_enabled is not None:
|
|
106
|
+
data["daily_spend_limit_enabled"] = daily_spend_limit_enabled
|
|
107
|
+
if mms_fall_back_to_sms is not None:
|
|
108
|
+
data["mms_fall_back_to_sms"] = mms_fall_back_to_sms
|
|
109
|
+
if mms_transcoding is not None:
|
|
110
|
+
data["mms_transcoding"] = mms_transcoding
|
|
111
|
+
|
|
112
|
+
return self.client.post("messaging_profiles", data=data)
|
|
113
|
+
|
|
114
|
+
def get_messaging_profile(self, profile_id: str) -> Dict[str, Any]:
|
|
115
|
+
"""Retrieve a messaging profile by ID.
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
profile_id: The ID of the messaging profile to retrieve
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
Dict[str, Any]: Response data containing messaging profile details
|
|
122
|
+
"""
|
|
123
|
+
return self.client.get(f"messaging_profiles/{profile_id}")
|
|
124
|
+
|
|
125
|
+
def update_messaging_profile(
|
|
126
|
+
self,
|
|
127
|
+
profile_id: str,
|
|
128
|
+
name: Optional[str] = None,
|
|
129
|
+
enabled: Optional[bool] = None,
|
|
130
|
+
webhook_url: Optional[str] = None,
|
|
131
|
+
webhook_failover_url: Optional[str] = None,
|
|
132
|
+
webhook_api_version: Optional[str] = None,
|
|
133
|
+
whitelisted_destinations: Optional[List[str]] = None,
|
|
134
|
+
v1_secret: Optional[str] = None,
|
|
135
|
+
number_pool_settings: Optional[dict] = None,
|
|
136
|
+
url_shortener_settings: Optional[dict] = None,
|
|
137
|
+
alpha_sender: Optional[str] = None,
|
|
138
|
+
daily_spend_limit: Optional[str] = None,
|
|
139
|
+
daily_spend_limit_enabled: Optional[bool] = None,
|
|
140
|
+
mms_fall_back_to_sms: Optional[bool] = None,
|
|
141
|
+
mms_transcoding: Optional[bool] = None,
|
|
142
|
+
) -> Dict[str, Any]:
|
|
143
|
+
"""Update a messaging profile.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
profile_id: The ID of the messaging profile to update
|
|
147
|
+
name: A user friendly name for the messaging profile
|
|
148
|
+
enabled: Specifies whether the messaging profile is enabled or not
|
|
149
|
+
webhook_url: The URL where webhooks related to this messaging profile will be sent
|
|
150
|
+
webhook_failover_url: The failover URL where webhooks related to this messaging profile will be sent
|
|
151
|
+
webhook_api_version: Determines which webhook format will be used
|
|
152
|
+
whitelisted_destinations: Destinations to which the messaging profile is allowed to send
|
|
153
|
+
v1_secret: Secret used to authenticate with v1 endpoints
|
|
154
|
+
number_pool_settings: Number Pool settings
|
|
155
|
+
url_shortener_settings: URL shortener settings
|
|
156
|
+
alpha_sender: The alphanumeric sender ID
|
|
157
|
+
daily_spend_limit: The maximum amount of money that can be spent
|
|
158
|
+
daily_spend_limit_enabled: Whether to enforce the daily spend limit
|
|
159
|
+
mms_fall_back_to_sms: Enables SMS fallback for MMS messages
|
|
160
|
+
mms_transcoding: Enables automated resizing of MMS media
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
Dict[str, Any]: Response data containing the updated messaging profile
|
|
164
|
+
"""
|
|
165
|
+
data = {}
|
|
166
|
+
|
|
167
|
+
if name is not None:
|
|
168
|
+
data["name"] = name
|
|
169
|
+
if enabled is not None:
|
|
170
|
+
data["enabled"] = enabled
|
|
171
|
+
if webhook_url is not None:
|
|
172
|
+
data["webhook_url"] = webhook_url
|
|
173
|
+
if webhook_failover_url is not None:
|
|
174
|
+
data["webhook_failover_url"] = webhook_failover_url
|
|
175
|
+
if webhook_api_version is not None:
|
|
176
|
+
data["webhook_api_version"] = webhook_api_version
|
|
177
|
+
if whitelisted_destinations is not None:
|
|
178
|
+
data["whitelisted_destinations"] = whitelisted_destinations
|
|
179
|
+
if v1_secret is not None:
|
|
180
|
+
data["v1_secret"] = v1_secret
|
|
181
|
+
if number_pool_settings is not None:
|
|
182
|
+
data["number_pool_settings"] = number_pool_settings
|
|
183
|
+
if url_shortener_settings is not None:
|
|
184
|
+
data["url_shortener_settings"] = url_shortener_settings
|
|
185
|
+
if alpha_sender is not None:
|
|
186
|
+
data["alpha_sender"] = alpha_sender
|
|
187
|
+
if daily_spend_limit is not None:
|
|
188
|
+
data["daily_spend_limit"] = daily_spend_limit
|
|
189
|
+
if daily_spend_limit_enabled is not None:
|
|
190
|
+
data["daily_spend_limit_enabled"] = daily_spend_limit_enabled
|
|
191
|
+
if mms_fall_back_to_sms is not None:
|
|
192
|
+
data["mms_fall_back_to_sms"] = mms_fall_back_to_sms
|
|
193
|
+
if mms_transcoding is not None:
|
|
194
|
+
data["mms_transcoding"] = mms_transcoding
|
|
195
|
+
|
|
196
|
+
return self.client.patch(f"messaging_profiles/{profile_id}", data=data)
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"""Telnyx phone numbers service."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Optional
|
|
4
|
+
|
|
5
|
+
from ...utils.logger import get_logger
|
|
6
|
+
from ..client import TelnyxClient
|
|
7
|
+
|
|
8
|
+
logger = get_logger(__name__)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class NumbersService:
|
|
12
|
+
"""Telnyx phone numbers service."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, client: Optional[TelnyxClient] = None):
|
|
15
|
+
"""Initialize the service.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
client: Telnyx API client (creates a new one if not provided)
|
|
19
|
+
"""
|
|
20
|
+
self.client = client or TelnyxClient()
|
|
21
|
+
|
|
22
|
+
def list_phone_numbers(
|
|
23
|
+
self,
|
|
24
|
+
page: int = 1,
|
|
25
|
+
page_size: int = 20,
|
|
26
|
+
filter_tag: Optional[str] = None,
|
|
27
|
+
filter_phone_number: Optional[str] = None,
|
|
28
|
+
filter_status: Optional[str] = None,
|
|
29
|
+
filter_country_iso_alpha2: Optional[str] = None,
|
|
30
|
+
) -> Dict[str, Any]:
|
|
31
|
+
"""List phone numbers.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
page: Page number
|
|
35
|
+
page_size: Page size
|
|
36
|
+
filter_tag: Filter by phone number tag
|
|
37
|
+
filter_phone_number: Filter by phone number
|
|
38
|
+
filter_status: Filter by phone number status
|
|
39
|
+
filter_country_iso_alpha2: Filter by country ISO alpha-2 code
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
Dict[str, Any]: Response data
|
|
43
|
+
"""
|
|
44
|
+
params = {
|
|
45
|
+
"page[number]": page,
|
|
46
|
+
"page[size]": page_size,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if filter_tag:
|
|
50
|
+
params["filter[tag]"] = filter_tag
|
|
51
|
+
|
|
52
|
+
if filter_phone_number:
|
|
53
|
+
params["filter[phone_number]"] = filter_phone_number
|
|
54
|
+
|
|
55
|
+
if filter_status:
|
|
56
|
+
params["filter[status]"] = filter_status
|
|
57
|
+
|
|
58
|
+
if filter_country_iso_alpha2:
|
|
59
|
+
params["filter[country_iso_alpha2]"] = filter_country_iso_alpha2
|
|
60
|
+
|
|
61
|
+
return self.client.get("phone_numbers", params=params)
|
|
62
|
+
|
|
63
|
+
def get_phone_number(self, id: str) -> Dict[str, Any]:
|
|
64
|
+
"""Get a phone number by ID.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
id: Phone number ID as string
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
Dict[str, Any]: Response data
|
|
71
|
+
"""
|
|
72
|
+
return self.client.get(f"phone_numbers/{id}")
|
|
73
|
+
|
|
74
|
+
def update_phone_number(
|
|
75
|
+
self, id: str, data: Dict[str, Any]
|
|
76
|
+
) -> Dict[str, Any]:
|
|
77
|
+
"""Update a phone number.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
id: Phone number ID as string
|
|
81
|
+
data: Update data
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
Dict[str, Any]: Response data
|
|
85
|
+
"""
|
|
86
|
+
return self.client.patch(f"phone_numbers/{id}", data=data)
|
|
87
|
+
|
|
88
|
+
def list_available_phone_numbers(
|
|
89
|
+
self,
|
|
90
|
+
page: int = 1,
|
|
91
|
+
page_size: int = 20,
|
|
92
|
+
filter_phone_number_starts_with: Optional[str] = None,
|
|
93
|
+
filter_phone_number_ends_with: Optional[str] = None,
|
|
94
|
+
filter_phone_number_contains: Optional[str] = None,
|
|
95
|
+
filter_locality: Optional[str] = None,
|
|
96
|
+
filter_administrative_area: Optional[str] = None,
|
|
97
|
+
filter_country_code: Optional[str] = None,
|
|
98
|
+
filter_features: Optional[List[str]] = None,
|
|
99
|
+
) -> Dict[str, Any]:
|
|
100
|
+
"""List available phone numbers.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
page: Page number
|
|
104
|
+
page_size: Page size
|
|
105
|
+
filter_phone_number_starts_with: Filter numbers starting with pattern
|
|
106
|
+
filter_phone_number_ends_with: Filter numbers ending with pattern
|
|
107
|
+
filter_phone_number_contains: Filter numbers containing pattern
|
|
108
|
+
filter_locality: Filter by locality (city)
|
|
109
|
+
filter_administrative_area: Filter by administrative area (state)
|
|
110
|
+
filter_country_code: Filter by country code
|
|
111
|
+
filter_features: Filter by features
|
|
112
|
+
|
|
113
|
+
Returns:
|
|
114
|
+
Dict[str, Any]: Response data
|
|
115
|
+
"""
|
|
116
|
+
params = {
|
|
117
|
+
"page[number]": page,
|
|
118
|
+
"page[size]": page_size,
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if filter_phone_number_starts_with:
|
|
122
|
+
params["filter[phone_number][starts_with]"] = (
|
|
123
|
+
filter_phone_number_starts_with
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
if filter_phone_number_ends_with:
|
|
127
|
+
params["filter[phone_number][ends_with]"] = (
|
|
128
|
+
filter_phone_number_ends_with
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
if filter_phone_number_contains:
|
|
132
|
+
params["filter[phone_number][contains]"] = (
|
|
133
|
+
filter_phone_number_contains
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
if filter_locality:
|
|
137
|
+
params["filter[locality]"] = filter_locality
|
|
138
|
+
|
|
139
|
+
if filter_administrative_area:
|
|
140
|
+
params["filter[administrative_area]"] = filter_administrative_area
|
|
141
|
+
|
|
142
|
+
if filter_country_code:
|
|
143
|
+
params["filter[country_code]"] = filter_country_code
|
|
144
|
+
|
|
145
|
+
if filter_features:
|
|
146
|
+
params["filter[features]"] = ",".join(filter_features)
|
|
147
|
+
|
|
148
|
+
return self.client.get("available_phone_numbers", params=params)
|
|
149
|
+
|
|
150
|
+
def buy_phone_number(
|
|
151
|
+
self, phone_number: str, connection_id: Optional[str] = None
|
|
152
|
+
) -> Dict[str, Any]:
|
|
153
|
+
"""Buy a phone number.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
phone_number: Phone number to buy
|
|
157
|
+
connection_id: Connection ID to associate with the number
|
|
158
|
+
|
|
159
|
+
Returns:
|
|
160
|
+
Dict[str, Any]: Response data
|
|
161
|
+
"""
|
|
162
|
+
data = {"phone_numbers": [{"phone_number": phone_number}]}
|
|
163
|
+
|
|
164
|
+
if connection_id:
|
|
165
|
+
data["connection_id"] = connection_id
|
|
166
|
+
|
|
167
|
+
return self.client.post("number_orders", data=data)
|
|
168
|
+
|
|
169
|
+
def update_phone_number_messaging_settings(
|
|
170
|
+
self,
|
|
171
|
+
id: str,
|
|
172
|
+
messaging_profile_id: Optional[str] = None,
|
|
173
|
+
messaging_product: Optional[str] = None,
|
|
174
|
+
) -> Dict[str, Any]:
|
|
175
|
+
"""Update the messaging profile and/or messaging product of a phone number.
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
id: The phone number ID to update
|
|
179
|
+
messaging_profile_id: Configure the messaging profile this phone number is assigned to
|
|
180
|
+
messaging_product: Configure the messaging product for this number
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
Dict[str, Any]: Response data containing the updated phone number messaging settings
|
|
184
|
+
"""
|
|
185
|
+
data = {}
|
|
186
|
+
|
|
187
|
+
if messaging_profile_id is not None:
|
|
188
|
+
data["messaging_profile_id"] = messaging_profile_id
|
|
189
|
+
|
|
190
|
+
if messaging_product is not None:
|
|
191
|
+
data["messaging_product"] = messaging_product
|
|
192
|
+
|
|
193
|
+
return self.client.patch(f"phone_numbers/{id}/messaging", data=data)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""Telnyx secrets manager service."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, Optional
|
|
4
|
+
|
|
5
|
+
from ...utils.logger import get_logger
|
|
6
|
+
from ..client import TelnyxClient
|
|
7
|
+
|
|
8
|
+
logger = get_logger(__name__)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SecretsService:
|
|
12
|
+
"""Telnyx secrets manager service."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, client: Optional[TelnyxClient] = None):
|
|
15
|
+
"""Initialize the service.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
client: Telnyx API client (creates a new one if not provided)
|
|
19
|
+
"""
|
|
20
|
+
self.client = client or TelnyxClient()
|
|
21
|
+
|
|
22
|
+
def list_integration_secrets(
|
|
23
|
+
self,
|
|
24
|
+
page: int = 1,
|
|
25
|
+
page_size: int = 25,
|
|
26
|
+
filter_type: Optional[str] = None,
|
|
27
|
+
) -> Dict[str, Any]:
|
|
28
|
+
"""List integration secrets.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
page: Page number
|
|
32
|
+
page_size: Page size
|
|
33
|
+
filter_type: Filter by secret type (bearer, basic)
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
Dict[str, Any]: Response data
|
|
37
|
+
"""
|
|
38
|
+
params = {
|
|
39
|
+
"page[number]": page,
|
|
40
|
+
"page[size]": page_size,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if filter_type:
|
|
44
|
+
params["filter[type]"] = filter_type
|
|
45
|
+
|
|
46
|
+
return self.client.get("integration_secrets", params=params)
|
|
47
|
+
|
|
48
|
+
def create_integration_secret(
|
|
49
|
+
self, request: Dict[str, Any]
|
|
50
|
+
) -> Dict[str, Any]:
|
|
51
|
+
"""Create an integration secret.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
identifier: The unique identifier of the secret
|
|
55
|
+
type: The type of secret (bearer, basic)
|
|
56
|
+
token: The token for the secret (required for bearer type)
|
|
57
|
+
username: The username for the secret (required for basic type)
|
|
58
|
+
password: The password for the secret (required for basic type)
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
Dict[str, Any]: Response data
|
|
62
|
+
"""
|
|
63
|
+
return self.client.post("integration_secrets", data=request)
|
|
64
|
+
|
|
65
|
+
def delete_integration_secret(self, id: str) -> Dict[str, Any]:
|
|
66
|
+
"""Delete an integration secret.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
id: Secret ID
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
Dict[str, Any]: Response data (empty dict on success)
|
|
73
|
+
"""
|
|
74
|
+
return self.client.delete(f"integration_secrets/{id}")
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"""MCP tools package."""
|
|
2
|
+
|
|
3
|
+
# Import resource functions
|
|
4
|
+
from . import sms_conversations, webhooks
|
|
5
|
+
from .assistants import (
|
|
6
|
+
create_assistant,
|
|
7
|
+
get_assistant,
|
|
8
|
+
get_assistant_texml,
|
|
9
|
+
list_assistants,
|
|
10
|
+
mcp_telnyx_delete_assistant,
|
|
11
|
+
start_assistant_call,
|
|
12
|
+
update_assistant,
|
|
13
|
+
)
|
|
14
|
+
from .call_control import (
|
|
15
|
+
create_call_control_application,
|
|
16
|
+
get_call_control_application,
|
|
17
|
+
hangup,
|
|
18
|
+
list_call_control_applications,
|
|
19
|
+
make_call,
|
|
20
|
+
playback_start,
|
|
21
|
+
playback_stop,
|
|
22
|
+
send_dtmf,
|
|
23
|
+
speak,
|
|
24
|
+
transfer,
|
|
25
|
+
)
|
|
26
|
+
from .cloud_storage import (
|
|
27
|
+
cloud_storage_create_bucket,
|
|
28
|
+
cloud_storage_delete_object,
|
|
29
|
+
cloud_storage_download_file,
|
|
30
|
+
cloud_storage_get_bucket_location,
|
|
31
|
+
cloud_storage_list_buckets,
|
|
32
|
+
cloud_storage_list_objects,
|
|
33
|
+
cloud_storage_upload_file,
|
|
34
|
+
)
|
|
35
|
+
from .connections import get_connection, list_connections, update_connection
|
|
36
|
+
from .embeddings import (
|
|
37
|
+
create_embeddings,
|
|
38
|
+
embed_url,
|
|
39
|
+
list_embedded_buckets,
|
|
40
|
+
)
|
|
41
|
+
from .messaging import get_message, send_message
|
|
42
|
+
from .messaging_profiles import (
|
|
43
|
+
create_messaging_profile,
|
|
44
|
+
get_messaging_profile,
|
|
45
|
+
list_messaging_profiles,
|
|
46
|
+
update_messaging_profile,
|
|
47
|
+
)
|
|
48
|
+
from .phone_numbers import (
|
|
49
|
+
get_phone_number,
|
|
50
|
+
initiate_phone_number_order,
|
|
51
|
+
list_available_phone_numbers,
|
|
52
|
+
list_phone_numbers,
|
|
53
|
+
update_phone_number,
|
|
54
|
+
update_phone_number_messaging_settings,
|
|
55
|
+
)
|
|
56
|
+
from .secrets import (
|
|
57
|
+
create_integration_secret,
|
|
58
|
+
delete_integration_secret,
|
|
59
|
+
list_integration_secrets,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Import webhook tool functions
|
|
63
|
+
from .webhooks import get_webhook_events
|
|
64
|
+
|
|
65
|
+
__all__ = [
|
|
66
|
+
# Assistant tools
|
|
67
|
+
"create_assistant",
|
|
68
|
+
"get_assistant",
|
|
69
|
+
"get_assistant_texml",
|
|
70
|
+
"list_assistants",
|
|
71
|
+
"get_webhook_events",
|
|
72
|
+
"sms_conversations",
|
|
73
|
+
"webhooks",
|
|
74
|
+
"mcp_telnyx_delete_assistant",
|
|
75
|
+
"start_assistant_call",
|
|
76
|
+
"update_assistant",
|
|
77
|
+
# Call control tools
|
|
78
|
+
"create_call_control_application",
|
|
79
|
+
"get_call_control_application",
|
|
80
|
+
"hangup",
|
|
81
|
+
"list_call_control_applications",
|
|
82
|
+
"make_call",
|
|
83
|
+
"playback_start",
|
|
84
|
+
"playback_stop",
|
|
85
|
+
"send_dtmf",
|
|
86
|
+
"speak",
|
|
87
|
+
"transfer",
|
|
88
|
+
# Cloud storage tools
|
|
89
|
+
"cloud_storage_create_bucket",
|
|
90
|
+
"cloud_storage_list_buckets",
|
|
91
|
+
"cloud_storage_upload_file",
|
|
92
|
+
"cloud_storage_download_file",
|
|
93
|
+
"cloud_storage_list_objects",
|
|
94
|
+
"cloud_storage_delete_object",
|
|
95
|
+
"cloud_storage_get_bucket_location",
|
|
96
|
+
"cloud_storage_create_bucket",
|
|
97
|
+
# Connection tools
|
|
98
|
+
"get_connection",
|
|
99
|
+
"list_connections",
|
|
100
|
+
"update_connection",
|
|
101
|
+
# Embeddings tools
|
|
102
|
+
"create_embeddings",
|
|
103
|
+
"embed_url",
|
|
104
|
+
"list_embedded_buckets",
|
|
105
|
+
# Messaging tools
|
|
106
|
+
"send_message",
|
|
107
|
+
"get_message",
|
|
108
|
+
# Messaging profile tools
|
|
109
|
+
"create_messaging_profile",
|
|
110
|
+
"get_messaging_profile",
|
|
111
|
+
"list_messaging_profiles",
|
|
112
|
+
"update_messaging_profile",
|
|
113
|
+
# Phone number tools
|
|
114
|
+
"initiate_phone_number_order",
|
|
115
|
+
"get_phone_number",
|
|
116
|
+
"list_available_phone_numbers",
|
|
117
|
+
"list_phone_numbers",
|
|
118
|
+
"update_phone_number",
|
|
119
|
+
"update_phone_number_messaging_settings",
|
|
120
|
+
# Secrets manager tools
|
|
121
|
+
"create_integration_secret",
|
|
122
|
+
"delete_integration_secret",
|
|
123
|
+
"list_integration_secrets",
|
|
124
|
+
# Webhook tools
|
|
125
|
+
"get_webhook_events",
|
|
126
|
+
]
|