phenoml 0.0.1__py3-none-any.whl → 0.0.5__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.
Potentially problematic release.
This version of phenoml might be problematic. Click here for more details.
- phenoml/agent/__init__.py +10 -12
- phenoml/agent/client.py +172 -65
- phenoml/agent/prompts/client.py +60 -60
- phenoml/agent/prompts/raw_client.py +134 -134
- phenoml/agent/raw_client.py +236 -69
- phenoml/agent/types/__init__.py +10 -12
- phenoml/agent/types/agent_create_request.py +53 -0
- phenoml/agent/types/agent_create_request_provider.py +1 -9
- phenoml/agent/types/agent_get_chat_messages_request_order.py +5 -0
- phenoml/agent/types/agent_get_chat_messages_response.py +22 -0
- phenoml/agent/types/agent_template.py +6 -4
- phenoml/agent/types/agent_template_provider.py +1 -9
- phenoml/agent/types/chat_message_template.py +72 -0
- phenoml/agent/types/chat_session_template.py +67 -0
- phenoml/client.py +6 -0
- phenoml/core/client_wrapper.py +2 -2
- phenoml/fhir/__init__.py +36 -0
- phenoml/fhir/client.py +970 -0
- phenoml/fhir/errors/__init__.py +10 -0
- phenoml/fhir/errors/bad_request_error.py +10 -0
- phenoml/fhir/errors/internal_server_error.py +10 -0
- phenoml/fhir/errors/not_found_error.py +10 -0
- phenoml/fhir/errors/unauthorized_error.py +10 -0
- phenoml/fhir/raw_client.py +1385 -0
- phenoml/fhir/types/__init__.py +29 -0
- phenoml/{agent/types/chat_fhir_client_config.py → fhir/types/error_response.py} +11 -6
- phenoml/fhir/types/fhir_bundle.py +43 -0
- phenoml/fhir/types/fhir_bundle_entry_item.py +34 -0
- phenoml/fhir/types/fhir_bundle_entry_item_request.py +25 -0
- phenoml/fhir/types/fhir_bundle_entry_item_request_method.py +5 -0
- phenoml/fhir/types/fhir_bundle_entry_item_response.py +24 -0
- phenoml/fhir/types/fhir_patch_request_body_item.py +36 -0
- phenoml/fhir/types/fhir_patch_request_body_item_op.py +7 -0
- phenoml/fhir/types/fhir_resource.py +40 -0
- phenoml/fhir/types/fhir_resource_meta.py +28 -0
- phenoml/fhir/types/fhir_search_response.py +8 -0
- phenoml/fhir_provider/__init__.py +43 -0
- phenoml/fhir_provider/client.py +731 -0
- phenoml/fhir_provider/errors/__init__.py +11 -0
- phenoml/fhir_provider/errors/bad_request_error.py +10 -0
- phenoml/fhir_provider/errors/forbidden_error.py +10 -0
- phenoml/fhir_provider/errors/internal_server_error.py +10 -0
- phenoml/fhir_provider/errors/not_found_error.py +10 -0
- phenoml/fhir_provider/errors/unauthorized_error.py +10 -0
- phenoml/fhir_provider/raw_client.py +1445 -0
- phenoml/fhir_provider/types/__init__.py +35 -0
- phenoml/fhir_provider/types/auth_method.py +7 -0
- phenoml/fhir_provider/types/fhir_provider_auth_config.py +53 -0
- phenoml/fhir_provider/types/fhir_provider_delete_response.py +20 -0
- phenoml/fhir_provider/types/fhir_provider_list_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_remove_auth_config_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_set_active_auth_config_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_template.py +66 -0
- phenoml/fhir_provider/types/fhir_query_response.py +27 -0
- phenoml/fhir_provider/types/fhir_query_response_data.py +5 -0
- phenoml/fhir_provider/types/json_web_key.py +51 -0
- phenoml/fhir_provider/types/provider.py +8 -0
- phenoml/fhir_provider/types/service_account_key.py +35 -0
- phenoml/fhir_provider/types/smart_configuration.py +46 -0
- phenoml/tools/__init__.py +12 -8
- phenoml/tools/client.py +27 -60
- phenoml/tools/mcp_server/__init__.py +7 -0
- phenoml/tools/mcp_server/client.py +336 -0
- phenoml/tools/mcp_server/raw_client.py +641 -0
- phenoml/tools/mcp_server/tools/__init__.py +4 -0
- phenoml/tools/mcp_server/tools/client.py +358 -0
- phenoml/tools/mcp_server/tools/raw_client.py +656 -0
- phenoml/tools/raw_client.py +18 -67
- phenoml/tools/types/__init__.py +10 -8
- phenoml/{agent/types/agent_fhir_config.py → tools/types/mcp_server_response.py} +8 -6
- phenoml/tools/types/mcp_server_response_data.py +51 -0
- phenoml/tools/types/mcp_server_tool_call_response.py +37 -0
- phenoml/tools/types/{fhir_client_config.py → mcp_server_tool_response.py} +8 -6
- phenoml/tools/types/mcp_server_tool_response_data.py +61 -0
- {phenoml-0.0.1.dist-info → phenoml-0.0.5.dist-info}/METADATA +1 -1
- {phenoml-0.0.1.dist-info → phenoml-0.0.5.dist-info}/RECORD +79 -29
- phenoml/agent/types/agent_create_request_provider_item.py +0 -7
- phenoml/agent/types/agent_template_provider_item.py +0 -5
- phenoml/agent/types/agent_update_request_provider.py +0 -13
- phenoml/agent/types/agent_update_request_provider_item.py +0 -7
- phenoml/tools/types/cohort_request_provider.py +0 -5
- phenoml/tools/types/lang2fhir_and_create_request_provider.py +0 -7
- phenoml/tools/types/lang2fhir_and_search_request_provider.py +0 -7
- {phenoml-0.0.1.dist-info → phenoml-0.0.5.dist-info}/LICENSE +0 -0
- {phenoml-0.0.1.dist-info → phenoml-0.0.5.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ...core.api_error import ApiError
|
|
7
|
+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ...core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
10
|
+
from ...core.pydantic_utilities import parse_obj_as
|
|
11
|
+
from ...core.request_options import RequestOptions
|
|
12
|
+
from ..errors.bad_request_error import BadRequestError
|
|
13
|
+
from ..errors.forbidden_error import ForbiddenError
|
|
14
|
+
from ..errors.internal_server_error import InternalServerError
|
|
15
|
+
from ..errors.unauthorized_error import UnauthorizedError
|
|
16
|
+
from ..types.mcp_server_response import McpServerResponse
|
|
17
|
+
|
|
18
|
+
# this is used as the default value for optional parameters
|
|
19
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class RawMcpServerClient:
|
|
23
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
24
|
+
self._client_wrapper = client_wrapper
|
|
25
|
+
|
|
26
|
+
def create(
|
|
27
|
+
self, *, name: str, mcp_server_url: str, request_options: typing.Optional[RequestOptions] = None
|
|
28
|
+
) -> HttpResponse[McpServerResponse]:
|
|
29
|
+
"""
|
|
30
|
+
Creates a new MCP server
|
|
31
|
+
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
name : str
|
|
35
|
+
Name of the MCP server
|
|
36
|
+
|
|
37
|
+
mcp_server_url : str
|
|
38
|
+
URL of the MCP server
|
|
39
|
+
|
|
40
|
+
request_options : typing.Optional[RequestOptions]
|
|
41
|
+
Request-specific configuration.
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
HttpResponse[McpServerResponse]
|
|
46
|
+
Successfully created MCP server
|
|
47
|
+
"""
|
|
48
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
49
|
+
"tools/mcp-server/create",
|
|
50
|
+
method="POST",
|
|
51
|
+
json={
|
|
52
|
+
"name": name,
|
|
53
|
+
"mcp_server_url": mcp_server_url,
|
|
54
|
+
},
|
|
55
|
+
headers={
|
|
56
|
+
"content-type": "application/json",
|
|
57
|
+
},
|
|
58
|
+
request_options=request_options,
|
|
59
|
+
omit=OMIT,
|
|
60
|
+
)
|
|
61
|
+
try:
|
|
62
|
+
if 200 <= _response.status_code < 300:
|
|
63
|
+
_data = typing.cast(
|
|
64
|
+
McpServerResponse,
|
|
65
|
+
parse_obj_as(
|
|
66
|
+
type_=McpServerResponse, # type: ignore
|
|
67
|
+
object_=_response.json(),
|
|
68
|
+
),
|
|
69
|
+
)
|
|
70
|
+
return HttpResponse(response=_response, data=_data)
|
|
71
|
+
if _response.status_code == 400:
|
|
72
|
+
raise BadRequestError(
|
|
73
|
+
headers=dict(_response.headers),
|
|
74
|
+
body=typing.cast(
|
|
75
|
+
typing.Optional[typing.Any],
|
|
76
|
+
parse_obj_as(
|
|
77
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
78
|
+
object_=_response.json(),
|
|
79
|
+
),
|
|
80
|
+
),
|
|
81
|
+
)
|
|
82
|
+
if _response.status_code == 401:
|
|
83
|
+
raise UnauthorizedError(
|
|
84
|
+
headers=dict(_response.headers),
|
|
85
|
+
body=typing.cast(
|
|
86
|
+
typing.Optional[typing.Any],
|
|
87
|
+
parse_obj_as(
|
|
88
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
89
|
+
object_=_response.json(),
|
|
90
|
+
),
|
|
91
|
+
),
|
|
92
|
+
)
|
|
93
|
+
if _response.status_code == 403:
|
|
94
|
+
raise ForbiddenError(
|
|
95
|
+
headers=dict(_response.headers),
|
|
96
|
+
body=typing.cast(
|
|
97
|
+
typing.Optional[typing.Any],
|
|
98
|
+
parse_obj_as(
|
|
99
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
100
|
+
object_=_response.json(),
|
|
101
|
+
),
|
|
102
|
+
),
|
|
103
|
+
)
|
|
104
|
+
if _response.status_code == 500:
|
|
105
|
+
raise InternalServerError(
|
|
106
|
+
headers=dict(_response.headers),
|
|
107
|
+
body=typing.cast(
|
|
108
|
+
typing.Optional[typing.Any],
|
|
109
|
+
parse_obj_as(
|
|
110
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
111
|
+
object_=_response.json(),
|
|
112
|
+
),
|
|
113
|
+
),
|
|
114
|
+
)
|
|
115
|
+
_response_json = _response.json()
|
|
116
|
+
except JSONDecodeError:
|
|
117
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
118
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
119
|
+
|
|
120
|
+
def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[McpServerResponse]:
|
|
121
|
+
"""
|
|
122
|
+
Lists all MCP servers for a specific user
|
|
123
|
+
|
|
124
|
+
Parameters
|
|
125
|
+
----------
|
|
126
|
+
request_options : typing.Optional[RequestOptions]
|
|
127
|
+
Request-specific configuration.
|
|
128
|
+
|
|
129
|
+
Returns
|
|
130
|
+
-------
|
|
131
|
+
HttpResponse[McpServerResponse]
|
|
132
|
+
Successfully listed MCP servers
|
|
133
|
+
"""
|
|
134
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
135
|
+
"tools/mcp-server/list",
|
|
136
|
+
method="GET",
|
|
137
|
+
request_options=request_options,
|
|
138
|
+
)
|
|
139
|
+
try:
|
|
140
|
+
if 200 <= _response.status_code < 300:
|
|
141
|
+
_data = typing.cast(
|
|
142
|
+
McpServerResponse,
|
|
143
|
+
parse_obj_as(
|
|
144
|
+
type_=McpServerResponse, # type: ignore
|
|
145
|
+
object_=_response.json(),
|
|
146
|
+
),
|
|
147
|
+
)
|
|
148
|
+
return HttpResponse(response=_response, data=_data)
|
|
149
|
+
if _response.status_code == 401:
|
|
150
|
+
raise UnauthorizedError(
|
|
151
|
+
headers=dict(_response.headers),
|
|
152
|
+
body=typing.cast(
|
|
153
|
+
typing.Optional[typing.Any],
|
|
154
|
+
parse_obj_as(
|
|
155
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
156
|
+
object_=_response.json(),
|
|
157
|
+
),
|
|
158
|
+
),
|
|
159
|
+
)
|
|
160
|
+
if _response.status_code == 403:
|
|
161
|
+
raise ForbiddenError(
|
|
162
|
+
headers=dict(_response.headers),
|
|
163
|
+
body=typing.cast(
|
|
164
|
+
typing.Optional[typing.Any],
|
|
165
|
+
parse_obj_as(
|
|
166
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
167
|
+
object_=_response.json(),
|
|
168
|
+
),
|
|
169
|
+
),
|
|
170
|
+
)
|
|
171
|
+
if _response.status_code == 500:
|
|
172
|
+
raise InternalServerError(
|
|
173
|
+
headers=dict(_response.headers),
|
|
174
|
+
body=typing.cast(
|
|
175
|
+
typing.Optional[typing.Any],
|
|
176
|
+
parse_obj_as(
|
|
177
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
178
|
+
object_=_response.json(),
|
|
179
|
+
),
|
|
180
|
+
),
|
|
181
|
+
)
|
|
182
|
+
_response_json = _response.json()
|
|
183
|
+
except JSONDecodeError:
|
|
184
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
185
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
186
|
+
|
|
187
|
+
def get(
|
|
188
|
+
self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
189
|
+
) -> HttpResponse[McpServerResponse]:
|
|
190
|
+
"""
|
|
191
|
+
Gets a MCP server by ID
|
|
192
|
+
|
|
193
|
+
Parameters
|
|
194
|
+
----------
|
|
195
|
+
mcp_server_id : str
|
|
196
|
+
ID of the MCP server to retrieve
|
|
197
|
+
|
|
198
|
+
request_options : typing.Optional[RequestOptions]
|
|
199
|
+
Request-specific configuration.
|
|
200
|
+
|
|
201
|
+
Returns
|
|
202
|
+
-------
|
|
203
|
+
HttpResponse[McpServerResponse]
|
|
204
|
+
Successfully retrieved MCP server
|
|
205
|
+
"""
|
|
206
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
207
|
+
f"tools/mcp-server/{jsonable_encoder(mcp_server_id)}",
|
|
208
|
+
method="GET",
|
|
209
|
+
request_options=request_options,
|
|
210
|
+
)
|
|
211
|
+
try:
|
|
212
|
+
if 200 <= _response.status_code < 300:
|
|
213
|
+
_data = typing.cast(
|
|
214
|
+
McpServerResponse,
|
|
215
|
+
parse_obj_as(
|
|
216
|
+
type_=McpServerResponse, # type: ignore
|
|
217
|
+
object_=_response.json(),
|
|
218
|
+
),
|
|
219
|
+
)
|
|
220
|
+
return HttpResponse(response=_response, data=_data)
|
|
221
|
+
if _response.status_code == 401:
|
|
222
|
+
raise UnauthorizedError(
|
|
223
|
+
headers=dict(_response.headers),
|
|
224
|
+
body=typing.cast(
|
|
225
|
+
typing.Optional[typing.Any],
|
|
226
|
+
parse_obj_as(
|
|
227
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
228
|
+
object_=_response.json(),
|
|
229
|
+
),
|
|
230
|
+
),
|
|
231
|
+
)
|
|
232
|
+
if _response.status_code == 403:
|
|
233
|
+
raise ForbiddenError(
|
|
234
|
+
headers=dict(_response.headers),
|
|
235
|
+
body=typing.cast(
|
|
236
|
+
typing.Optional[typing.Any],
|
|
237
|
+
parse_obj_as(
|
|
238
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
239
|
+
object_=_response.json(),
|
|
240
|
+
),
|
|
241
|
+
),
|
|
242
|
+
)
|
|
243
|
+
if _response.status_code == 500:
|
|
244
|
+
raise InternalServerError(
|
|
245
|
+
headers=dict(_response.headers),
|
|
246
|
+
body=typing.cast(
|
|
247
|
+
typing.Optional[typing.Any],
|
|
248
|
+
parse_obj_as(
|
|
249
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
250
|
+
object_=_response.json(),
|
|
251
|
+
),
|
|
252
|
+
),
|
|
253
|
+
)
|
|
254
|
+
_response_json = _response.json()
|
|
255
|
+
except JSONDecodeError:
|
|
256
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
257
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
258
|
+
|
|
259
|
+
def delete(
|
|
260
|
+
self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
261
|
+
) -> HttpResponse[McpServerResponse]:
|
|
262
|
+
"""
|
|
263
|
+
Deletes a MCP server by ID
|
|
264
|
+
|
|
265
|
+
Parameters
|
|
266
|
+
----------
|
|
267
|
+
mcp_server_id : str
|
|
268
|
+
ID of the MCP server to delete
|
|
269
|
+
|
|
270
|
+
request_options : typing.Optional[RequestOptions]
|
|
271
|
+
Request-specific configuration.
|
|
272
|
+
|
|
273
|
+
Returns
|
|
274
|
+
-------
|
|
275
|
+
HttpResponse[McpServerResponse]
|
|
276
|
+
Successfully deleted MCP server
|
|
277
|
+
"""
|
|
278
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
279
|
+
f"tools/mcp-server/{jsonable_encoder(mcp_server_id)}",
|
|
280
|
+
method="DELETE",
|
|
281
|
+
request_options=request_options,
|
|
282
|
+
)
|
|
283
|
+
try:
|
|
284
|
+
if 200 <= _response.status_code < 300:
|
|
285
|
+
_data = typing.cast(
|
|
286
|
+
McpServerResponse,
|
|
287
|
+
parse_obj_as(
|
|
288
|
+
type_=McpServerResponse, # type: ignore
|
|
289
|
+
object_=_response.json(),
|
|
290
|
+
),
|
|
291
|
+
)
|
|
292
|
+
return HttpResponse(response=_response, data=_data)
|
|
293
|
+
if _response.status_code == 401:
|
|
294
|
+
raise UnauthorizedError(
|
|
295
|
+
headers=dict(_response.headers),
|
|
296
|
+
body=typing.cast(
|
|
297
|
+
typing.Optional[typing.Any],
|
|
298
|
+
parse_obj_as(
|
|
299
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
300
|
+
object_=_response.json(),
|
|
301
|
+
),
|
|
302
|
+
),
|
|
303
|
+
)
|
|
304
|
+
if _response.status_code == 403:
|
|
305
|
+
raise ForbiddenError(
|
|
306
|
+
headers=dict(_response.headers),
|
|
307
|
+
body=typing.cast(
|
|
308
|
+
typing.Optional[typing.Any],
|
|
309
|
+
parse_obj_as(
|
|
310
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
311
|
+
object_=_response.json(),
|
|
312
|
+
),
|
|
313
|
+
),
|
|
314
|
+
)
|
|
315
|
+
if _response.status_code == 500:
|
|
316
|
+
raise InternalServerError(
|
|
317
|
+
headers=dict(_response.headers),
|
|
318
|
+
body=typing.cast(
|
|
319
|
+
typing.Optional[typing.Any],
|
|
320
|
+
parse_obj_as(
|
|
321
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
322
|
+
object_=_response.json(),
|
|
323
|
+
),
|
|
324
|
+
),
|
|
325
|
+
)
|
|
326
|
+
_response_json = _response.json()
|
|
327
|
+
except JSONDecodeError:
|
|
328
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
329
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
class AsyncRawMcpServerClient:
|
|
333
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
334
|
+
self._client_wrapper = client_wrapper
|
|
335
|
+
|
|
336
|
+
async def create(
|
|
337
|
+
self, *, name: str, mcp_server_url: str, request_options: typing.Optional[RequestOptions] = None
|
|
338
|
+
) -> AsyncHttpResponse[McpServerResponse]:
|
|
339
|
+
"""
|
|
340
|
+
Creates a new MCP server
|
|
341
|
+
|
|
342
|
+
Parameters
|
|
343
|
+
----------
|
|
344
|
+
name : str
|
|
345
|
+
Name of the MCP server
|
|
346
|
+
|
|
347
|
+
mcp_server_url : str
|
|
348
|
+
URL of the MCP server
|
|
349
|
+
|
|
350
|
+
request_options : typing.Optional[RequestOptions]
|
|
351
|
+
Request-specific configuration.
|
|
352
|
+
|
|
353
|
+
Returns
|
|
354
|
+
-------
|
|
355
|
+
AsyncHttpResponse[McpServerResponse]
|
|
356
|
+
Successfully created MCP server
|
|
357
|
+
"""
|
|
358
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
359
|
+
"tools/mcp-server/create",
|
|
360
|
+
method="POST",
|
|
361
|
+
json={
|
|
362
|
+
"name": name,
|
|
363
|
+
"mcp_server_url": mcp_server_url,
|
|
364
|
+
},
|
|
365
|
+
headers={
|
|
366
|
+
"content-type": "application/json",
|
|
367
|
+
},
|
|
368
|
+
request_options=request_options,
|
|
369
|
+
omit=OMIT,
|
|
370
|
+
)
|
|
371
|
+
try:
|
|
372
|
+
if 200 <= _response.status_code < 300:
|
|
373
|
+
_data = typing.cast(
|
|
374
|
+
McpServerResponse,
|
|
375
|
+
parse_obj_as(
|
|
376
|
+
type_=McpServerResponse, # type: ignore
|
|
377
|
+
object_=_response.json(),
|
|
378
|
+
),
|
|
379
|
+
)
|
|
380
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
381
|
+
if _response.status_code == 400:
|
|
382
|
+
raise BadRequestError(
|
|
383
|
+
headers=dict(_response.headers),
|
|
384
|
+
body=typing.cast(
|
|
385
|
+
typing.Optional[typing.Any],
|
|
386
|
+
parse_obj_as(
|
|
387
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
388
|
+
object_=_response.json(),
|
|
389
|
+
),
|
|
390
|
+
),
|
|
391
|
+
)
|
|
392
|
+
if _response.status_code == 401:
|
|
393
|
+
raise UnauthorizedError(
|
|
394
|
+
headers=dict(_response.headers),
|
|
395
|
+
body=typing.cast(
|
|
396
|
+
typing.Optional[typing.Any],
|
|
397
|
+
parse_obj_as(
|
|
398
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
399
|
+
object_=_response.json(),
|
|
400
|
+
),
|
|
401
|
+
),
|
|
402
|
+
)
|
|
403
|
+
if _response.status_code == 403:
|
|
404
|
+
raise ForbiddenError(
|
|
405
|
+
headers=dict(_response.headers),
|
|
406
|
+
body=typing.cast(
|
|
407
|
+
typing.Optional[typing.Any],
|
|
408
|
+
parse_obj_as(
|
|
409
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
410
|
+
object_=_response.json(),
|
|
411
|
+
),
|
|
412
|
+
),
|
|
413
|
+
)
|
|
414
|
+
if _response.status_code == 500:
|
|
415
|
+
raise InternalServerError(
|
|
416
|
+
headers=dict(_response.headers),
|
|
417
|
+
body=typing.cast(
|
|
418
|
+
typing.Optional[typing.Any],
|
|
419
|
+
parse_obj_as(
|
|
420
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
421
|
+
object_=_response.json(),
|
|
422
|
+
),
|
|
423
|
+
),
|
|
424
|
+
)
|
|
425
|
+
_response_json = _response.json()
|
|
426
|
+
except JSONDecodeError:
|
|
427
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
428
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
429
|
+
|
|
430
|
+
async def list(
|
|
431
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
432
|
+
) -> AsyncHttpResponse[McpServerResponse]:
|
|
433
|
+
"""
|
|
434
|
+
Lists all MCP servers for a specific user
|
|
435
|
+
|
|
436
|
+
Parameters
|
|
437
|
+
----------
|
|
438
|
+
request_options : typing.Optional[RequestOptions]
|
|
439
|
+
Request-specific configuration.
|
|
440
|
+
|
|
441
|
+
Returns
|
|
442
|
+
-------
|
|
443
|
+
AsyncHttpResponse[McpServerResponse]
|
|
444
|
+
Successfully listed MCP servers
|
|
445
|
+
"""
|
|
446
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
447
|
+
"tools/mcp-server/list",
|
|
448
|
+
method="GET",
|
|
449
|
+
request_options=request_options,
|
|
450
|
+
)
|
|
451
|
+
try:
|
|
452
|
+
if 200 <= _response.status_code < 300:
|
|
453
|
+
_data = typing.cast(
|
|
454
|
+
McpServerResponse,
|
|
455
|
+
parse_obj_as(
|
|
456
|
+
type_=McpServerResponse, # type: ignore
|
|
457
|
+
object_=_response.json(),
|
|
458
|
+
),
|
|
459
|
+
)
|
|
460
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
461
|
+
if _response.status_code == 401:
|
|
462
|
+
raise UnauthorizedError(
|
|
463
|
+
headers=dict(_response.headers),
|
|
464
|
+
body=typing.cast(
|
|
465
|
+
typing.Optional[typing.Any],
|
|
466
|
+
parse_obj_as(
|
|
467
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
468
|
+
object_=_response.json(),
|
|
469
|
+
),
|
|
470
|
+
),
|
|
471
|
+
)
|
|
472
|
+
if _response.status_code == 403:
|
|
473
|
+
raise ForbiddenError(
|
|
474
|
+
headers=dict(_response.headers),
|
|
475
|
+
body=typing.cast(
|
|
476
|
+
typing.Optional[typing.Any],
|
|
477
|
+
parse_obj_as(
|
|
478
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
479
|
+
object_=_response.json(),
|
|
480
|
+
),
|
|
481
|
+
),
|
|
482
|
+
)
|
|
483
|
+
if _response.status_code == 500:
|
|
484
|
+
raise InternalServerError(
|
|
485
|
+
headers=dict(_response.headers),
|
|
486
|
+
body=typing.cast(
|
|
487
|
+
typing.Optional[typing.Any],
|
|
488
|
+
parse_obj_as(
|
|
489
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
490
|
+
object_=_response.json(),
|
|
491
|
+
),
|
|
492
|
+
),
|
|
493
|
+
)
|
|
494
|
+
_response_json = _response.json()
|
|
495
|
+
except JSONDecodeError:
|
|
496
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
497
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
498
|
+
|
|
499
|
+
async def get(
|
|
500
|
+
self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
501
|
+
) -> AsyncHttpResponse[McpServerResponse]:
|
|
502
|
+
"""
|
|
503
|
+
Gets a MCP server by ID
|
|
504
|
+
|
|
505
|
+
Parameters
|
|
506
|
+
----------
|
|
507
|
+
mcp_server_id : str
|
|
508
|
+
ID of the MCP server to retrieve
|
|
509
|
+
|
|
510
|
+
request_options : typing.Optional[RequestOptions]
|
|
511
|
+
Request-specific configuration.
|
|
512
|
+
|
|
513
|
+
Returns
|
|
514
|
+
-------
|
|
515
|
+
AsyncHttpResponse[McpServerResponse]
|
|
516
|
+
Successfully retrieved MCP server
|
|
517
|
+
"""
|
|
518
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
519
|
+
f"tools/mcp-server/{jsonable_encoder(mcp_server_id)}",
|
|
520
|
+
method="GET",
|
|
521
|
+
request_options=request_options,
|
|
522
|
+
)
|
|
523
|
+
try:
|
|
524
|
+
if 200 <= _response.status_code < 300:
|
|
525
|
+
_data = typing.cast(
|
|
526
|
+
McpServerResponse,
|
|
527
|
+
parse_obj_as(
|
|
528
|
+
type_=McpServerResponse, # type: ignore
|
|
529
|
+
object_=_response.json(),
|
|
530
|
+
),
|
|
531
|
+
)
|
|
532
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
533
|
+
if _response.status_code == 401:
|
|
534
|
+
raise UnauthorizedError(
|
|
535
|
+
headers=dict(_response.headers),
|
|
536
|
+
body=typing.cast(
|
|
537
|
+
typing.Optional[typing.Any],
|
|
538
|
+
parse_obj_as(
|
|
539
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
540
|
+
object_=_response.json(),
|
|
541
|
+
),
|
|
542
|
+
),
|
|
543
|
+
)
|
|
544
|
+
if _response.status_code == 403:
|
|
545
|
+
raise ForbiddenError(
|
|
546
|
+
headers=dict(_response.headers),
|
|
547
|
+
body=typing.cast(
|
|
548
|
+
typing.Optional[typing.Any],
|
|
549
|
+
parse_obj_as(
|
|
550
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
551
|
+
object_=_response.json(),
|
|
552
|
+
),
|
|
553
|
+
),
|
|
554
|
+
)
|
|
555
|
+
if _response.status_code == 500:
|
|
556
|
+
raise InternalServerError(
|
|
557
|
+
headers=dict(_response.headers),
|
|
558
|
+
body=typing.cast(
|
|
559
|
+
typing.Optional[typing.Any],
|
|
560
|
+
parse_obj_as(
|
|
561
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
562
|
+
object_=_response.json(),
|
|
563
|
+
),
|
|
564
|
+
),
|
|
565
|
+
)
|
|
566
|
+
_response_json = _response.json()
|
|
567
|
+
except JSONDecodeError:
|
|
568
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
569
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
570
|
+
|
|
571
|
+
async def delete(
|
|
572
|
+
self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
573
|
+
) -> AsyncHttpResponse[McpServerResponse]:
|
|
574
|
+
"""
|
|
575
|
+
Deletes a MCP server by ID
|
|
576
|
+
|
|
577
|
+
Parameters
|
|
578
|
+
----------
|
|
579
|
+
mcp_server_id : str
|
|
580
|
+
ID of the MCP server to delete
|
|
581
|
+
|
|
582
|
+
request_options : typing.Optional[RequestOptions]
|
|
583
|
+
Request-specific configuration.
|
|
584
|
+
|
|
585
|
+
Returns
|
|
586
|
+
-------
|
|
587
|
+
AsyncHttpResponse[McpServerResponse]
|
|
588
|
+
Successfully deleted MCP server
|
|
589
|
+
"""
|
|
590
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
591
|
+
f"tools/mcp-server/{jsonable_encoder(mcp_server_id)}",
|
|
592
|
+
method="DELETE",
|
|
593
|
+
request_options=request_options,
|
|
594
|
+
)
|
|
595
|
+
try:
|
|
596
|
+
if 200 <= _response.status_code < 300:
|
|
597
|
+
_data = typing.cast(
|
|
598
|
+
McpServerResponse,
|
|
599
|
+
parse_obj_as(
|
|
600
|
+
type_=McpServerResponse, # type: ignore
|
|
601
|
+
object_=_response.json(),
|
|
602
|
+
),
|
|
603
|
+
)
|
|
604
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
605
|
+
if _response.status_code == 401:
|
|
606
|
+
raise UnauthorizedError(
|
|
607
|
+
headers=dict(_response.headers),
|
|
608
|
+
body=typing.cast(
|
|
609
|
+
typing.Optional[typing.Any],
|
|
610
|
+
parse_obj_as(
|
|
611
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
612
|
+
object_=_response.json(),
|
|
613
|
+
),
|
|
614
|
+
),
|
|
615
|
+
)
|
|
616
|
+
if _response.status_code == 403:
|
|
617
|
+
raise ForbiddenError(
|
|
618
|
+
headers=dict(_response.headers),
|
|
619
|
+
body=typing.cast(
|
|
620
|
+
typing.Optional[typing.Any],
|
|
621
|
+
parse_obj_as(
|
|
622
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
623
|
+
object_=_response.json(),
|
|
624
|
+
),
|
|
625
|
+
),
|
|
626
|
+
)
|
|
627
|
+
if _response.status_code == 500:
|
|
628
|
+
raise InternalServerError(
|
|
629
|
+
headers=dict(_response.headers),
|
|
630
|
+
body=typing.cast(
|
|
631
|
+
typing.Optional[typing.Any],
|
|
632
|
+
parse_obj_as(
|
|
633
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
634
|
+
object_=_response.json(),
|
|
635
|
+
),
|
|
636
|
+
),
|
|
637
|
+
)
|
|
638
|
+
_response_json = _response.json()
|
|
639
|
+
except JSONDecodeError:
|
|
640
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
641
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|