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
phenoml/tools/client.py
CHANGED
|
@@ -4,14 +4,11 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
|
+
from .mcp_server.client import AsyncMcpServerClient, McpServerClient
|
|
7
8
|
from .raw_client import AsyncRawToolsClient, RawToolsClient
|
|
8
|
-
from .types.cohort_request_provider import CohortRequestProvider
|
|
9
9
|
from .types.cohort_response import CohortResponse
|
|
10
|
-
from .types.fhir_client_config import FhirClientConfig
|
|
11
|
-
from .types.lang2fhir_and_create_request_provider import Lang2FhirAndCreateRequestProvider
|
|
12
10
|
from .types.lang2fhir_and_create_request_resource import Lang2FhirAndCreateRequestResource
|
|
13
11
|
from .types.lang2fhir_and_create_response import Lang2FhirAndCreateResponse
|
|
14
|
-
from .types.lang2fhir_and_search_request_provider import Lang2FhirAndSearchRequestProvider
|
|
15
12
|
from .types.lang2fhir_and_search_response import Lang2FhirAndSearchResponse
|
|
16
13
|
|
|
17
14
|
# this is used as the default value for optional parameters
|
|
@@ -21,6 +18,7 @@ OMIT = typing.cast(typing.Any, ...)
|
|
|
21
18
|
class ToolsClient:
|
|
22
19
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
23
20
|
self._raw_client = RawToolsClient(client_wrapper=client_wrapper)
|
|
21
|
+
self.mcp_server = McpServerClient(client_wrapper=client_wrapper)
|
|
24
22
|
|
|
25
23
|
@property
|
|
26
24
|
def with_raw_response(self) -> RawToolsClient:
|
|
@@ -38,8 +36,7 @@ class ToolsClient:
|
|
|
38
36
|
*,
|
|
39
37
|
resource: Lang2FhirAndCreateRequestResource,
|
|
40
38
|
text: str,
|
|
41
|
-
provider: typing.Optional[
|
|
42
|
-
meta: typing.Optional[FhirClientConfig] = OMIT,
|
|
39
|
+
provider: typing.Optional[str] = OMIT,
|
|
43
40
|
request_options: typing.Optional[RequestOptions] = None,
|
|
44
41
|
) -> Lang2FhirAndCreateResponse:
|
|
45
42
|
"""
|
|
@@ -53,10 +50,8 @@ class ToolsClient:
|
|
|
53
50
|
text : str
|
|
54
51
|
Natural language text to convert to FHIR resource
|
|
55
52
|
|
|
56
|
-
provider : typing.Optional[
|
|
57
|
-
FHIR provider
|
|
58
|
-
|
|
59
|
-
meta : typing.Optional[FhirClientConfig]
|
|
53
|
+
provider : typing.Optional[str]
|
|
54
|
+
FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
|
|
60
55
|
|
|
61
56
|
request_options : typing.Optional[RequestOptions]
|
|
62
57
|
Request-specific configuration.
|
|
@@ -79,7 +74,7 @@ class ToolsClient:
|
|
|
79
74
|
)
|
|
80
75
|
"""
|
|
81
76
|
_response = self._raw_client.create_fhir_resource(
|
|
82
|
-
resource=resource, text=text, provider=provider,
|
|
77
|
+
resource=resource, text=text, provider=provider, request_options=request_options
|
|
83
78
|
)
|
|
84
79
|
return _response.data
|
|
85
80
|
|
|
@@ -90,8 +85,7 @@ class ToolsClient:
|
|
|
90
85
|
patient_id: typing.Optional[str] = OMIT,
|
|
91
86
|
practitioner_id: typing.Optional[str] = OMIT,
|
|
92
87
|
count: typing.Optional[int] = OMIT,
|
|
93
|
-
provider: typing.Optional[
|
|
94
|
-
meta: typing.Optional[FhirClientConfig] = OMIT,
|
|
88
|
+
provider: typing.Optional[str] = OMIT,
|
|
95
89
|
request_options: typing.Optional[RequestOptions] = None,
|
|
96
90
|
) -> Lang2FhirAndSearchResponse:
|
|
97
91
|
"""
|
|
@@ -111,10 +105,8 @@ class ToolsClient:
|
|
|
111
105
|
count : typing.Optional[int]
|
|
112
106
|
Maximum number of results to return
|
|
113
107
|
|
|
114
|
-
provider : typing.Optional[
|
|
115
|
-
FHIR provider
|
|
116
|
-
|
|
117
|
-
meta : typing.Optional[FhirClientConfig]
|
|
108
|
+
provider : typing.Optional[str]
|
|
109
|
+
FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
|
|
118
110
|
|
|
119
111
|
request_options : typing.Optional[RequestOptions]
|
|
120
112
|
Request-specific configuration.
|
|
@@ -141,18 +133,12 @@ class ToolsClient:
|
|
|
141
133
|
practitioner_id=practitioner_id,
|
|
142
134
|
count=count,
|
|
143
135
|
provider=provider,
|
|
144
|
-
meta=meta,
|
|
145
136
|
request_options=request_options,
|
|
146
137
|
)
|
|
147
138
|
return _response.data
|
|
148
139
|
|
|
149
140
|
def analyze_cohort(
|
|
150
|
-
self,
|
|
151
|
-
*,
|
|
152
|
-
text: str,
|
|
153
|
-
provider: CohortRequestProvider,
|
|
154
|
-
meta: typing.Optional[FhirClientConfig] = OMIT,
|
|
155
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
141
|
+
self, *, text: str, provider: str, request_options: typing.Optional[RequestOptions] = None
|
|
156
142
|
) -> CohortResponse:
|
|
157
143
|
"""
|
|
158
144
|
Uses LLM to extract search concepts from natural language and builds patient cohorts with inclusion/exclusion criteria
|
|
@@ -162,10 +148,8 @@ class ToolsClient:
|
|
|
162
148
|
text : str
|
|
163
149
|
Natural language text describing the patient cohort criteria
|
|
164
150
|
|
|
165
|
-
provider :
|
|
166
|
-
FHIR provider
|
|
167
|
-
|
|
168
|
-
meta : typing.Optional[FhirClientConfig]
|
|
151
|
+
provider : str
|
|
152
|
+
FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
|
|
169
153
|
|
|
170
154
|
request_options : typing.Optional[RequestOptions]
|
|
171
155
|
Request-specific configuration.
|
|
@@ -184,18 +168,17 @@ class ToolsClient:
|
|
|
184
168
|
)
|
|
185
169
|
client.tools.analyze_cohort(
|
|
186
170
|
text="female patients over 20 with diabetes but not hypertension",
|
|
187
|
-
provider="
|
|
171
|
+
provider="550e8400-e29b-41d4-a716-446655440000",
|
|
188
172
|
)
|
|
189
173
|
"""
|
|
190
|
-
_response = self._raw_client.analyze_cohort(
|
|
191
|
-
text=text, provider=provider, meta=meta, request_options=request_options
|
|
192
|
-
)
|
|
174
|
+
_response = self._raw_client.analyze_cohort(text=text, provider=provider, request_options=request_options)
|
|
193
175
|
return _response.data
|
|
194
176
|
|
|
195
177
|
|
|
196
178
|
class AsyncToolsClient:
|
|
197
179
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
198
180
|
self._raw_client = AsyncRawToolsClient(client_wrapper=client_wrapper)
|
|
181
|
+
self.mcp_server = AsyncMcpServerClient(client_wrapper=client_wrapper)
|
|
199
182
|
|
|
200
183
|
@property
|
|
201
184
|
def with_raw_response(self) -> AsyncRawToolsClient:
|
|
@@ -213,8 +196,7 @@ class AsyncToolsClient:
|
|
|
213
196
|
*,
|
|
214
197
|
resource: Lang2FhirAndCreateRequestResource,
|
|
215
198
|
text: str,
|
|
216
|
-
provider: typing.Optional[
|
|
217
|
-
meta: typing.Optional[FhirClientConfig] = OMIT,
|
|
199
|
+
provider: typing.Optional[str] = OMIT,
|
|
218
200
|
request_options: typing.Optional[RequestOptions] = None,
|
|
219
201
|
) -> Lang2FhirAndCreateResponse:
|
|
220
202
|
"""
|
|
@@ -228,10 +210,8 @@ class AsyncToolsClient:
|
|
|
228
210
|
text : str
|
|
229
211
|
Natural language text to convert to FHIR resource
|
|
230
212
|
|
|
231
|
-
provider : typing.Optional[
|
|
232
|
-
FHIR provider
|
|
233
|
-
|
|
234
|
-
meta : typing.Optional[FhirClientConfig]
|
|
213
|
+
provider : typing.Optional[str]
|
|
214
|
+
FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
|
|
235
215
|
|
|
236
216
|
request_options : typing.Optional[RequestOptions]
|
|
237
217
|
Request-specific configuration.
|
|
@@ -262,7 +242,7 @@ class AsyncToolsClient:
|
|
|
262
242
|
asyncio.run(main())
|
|
263
243
|
"""
|
|
264
244
|
_response = await self._raw_client.create_fhir_resource(
|
|
265
|
-
resource=resource, text=text, provider=provider,
|
|
245
|
+
resource=resource, text=text, provider=provider, request_options=request_options
|
|
266
246
|
)
|
|
267
247
|
return _response.data
|
|
268
248
|
|
|
@@ -273,8 +253,7 @@ class AsyncToolsClient:
|
|
|
273
253
|
patient_id: typing.Optional[str] = OMIT,
|
|
274
254
|
practitioner_id: typing.Optional[str] = OMIT,
|
|
275
255
|
count: typing.Optional[int] = OMIT,
|
|
276
|
-
provider: typing.Optional[
|
|
277
|
-
meta: typing.Optional[FhirClientConfig] = OMIT,
|
|
256
|
+
provider: typing.Optional[str] = OMIT,
|
|
278
257
|
request_options: typing.Optional[RequestOptions] = None,
|
|
279
258
|
) -> Lang2FhirAndSearchResponse:
|
|
280
259
|
"""
|
|
@@ -294,10 +273,8 @@ class AsyncToolsClient:
|
|
|
294
273
|
count : typing.Optional[int]
|
|
295
274
|
Maximum number of results to return
|
|
296
275
|
|
|
297
|
-
provider : typing.Optional[
|
|
298
|
-
FHIR provider
|
|
299
|
-
|
|
300
|
-
meta : typing.Optional[FhirClientConfig]
|
|
276
|
+
provider : typing.Optional[str]
|
|
277
|
+
FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
|
|
301
278
|
|
|
302
279
|
request_options : typing.Optional[RequestOptions]
|
|
303
280
|
Request-specific configuration.
|
|
@@ -332,18 +309,12 @@ class AsyncToolsClient:
|
|
|
332
309
|
practitioner_id=practitioner_id,
|
|
333
310
|
count=count,
|
|
334
311
|
provider=provider,
|
|
335
|
-
meta=meta,
|
|
336
312
|
request_options=request_options,
|
|
337
313
|
)
|
|
338
314
|
return _response.data
|
|
339
315
|
|
|
340
316
|
async def analyze_cohort(
|
|
341
|
-
self,
|
|
342
|
-
*,
|
|
343
|
-
text: str,
|
|
344
|
-
provider: CohortRequestProvider,
|
|
345
|
-
meta: typing.Optional[FhirClientConfig] = OMIT,
|
|
346
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
317
|
+
self, *, text: str, provider: str, request_options: typing.Optional[RequestOptions] = None
|
|
347
318
|
) -> CohortResponse:
|
|
348
319
|
"""
|
|
349
320
|
Uses LLM to extract search concepts from natural language and builds patient cohorts with inclusion/exclusion criteria
|
|
@@ -353,10 +324,8 @@ class AsyncToolsClient:
|
|
|
353
324
|
text : str
|
|
354
325
|
Natural language text describing the patient cohort criteria
|
|
355
326
|
|
|
356
|
-
provider :
|
|
357
|
-
FHIR provider
|
|
358
|
-
|
|
359
|
-
meta : typing.Optional[FhirClientConfig]
|
|
327
|
+
provider : str
|
|
328
|
+
FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
|
|
360
329
|
|
|
361
330
|
request_options : typing.Optional[RequestOptions]
|
|
362
331
|
Request-specific configuration.
|
|
@@ -380,13 +349,11 @@ class AsyncToolsClient:
|
|
|
380
349
|
async def main() -> None:
|
|
381
350
|
await client.tools.analyze_cohort(
|
|
382
351
|
text="female patients over 20 with diabetes but not hypertension",
|
|
383
|
-
provider="
|
|
352
|
+
provider="550e8400-e29b-41d4-a716-446655440000",
|
|
384
353
|
)
|
|
385
354
|
|
|
386
355
|
|
|
387
356
|
asyncio.run(main())
|
|
388
357
|
"""
|
|
389
|
-
_response = await self._raw_client.analyze_cohort(
|
|
390
|
-
text=text, provider=provider, meta=meta, request_options=request_options
|
|
391
|
-
)
|
|
358
|
+
_response = await self._raw_client.analyze_cohort(text=text, provider=provider, request_options=request_options)
|
|
392
359
|
return _response.data
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ...core.request_options import RequestOptions
|
|
7
|
+
from ..types.mcp_server_response import McpServerResponse
|
|
8
|
+
from .raw_client import AsyncRawMcpServerClient, RawMcpServerClient
|
|
9
|
+
from .tools.client import AsyncToolsClient, ToolsClient
|
|
10
|
+
|
|
11
|
+
# this is used as the default value for optional parameters
|
|
12
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class McpServerClient:
|
|
16
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
17
|
+
self._raw_client = RawMcpServerClient(client_wrapper=client_wrapper)
|
|
18
|
+
self.tools = ToolsClient(client_wrapper=client_wrapper)
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def with_raw_response(self) -> RawMcpServerClient:
|
|
22
|
+
"""
|
|
23
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
24
|
+
|
|
25
|
+
Returns
|
|
26
|
+
-------
|
|
27
|
+
RawMcpServerClient
|
|
28
|
+
"""
|
|
29
|
+
return self._raw_client
|
|
30
|
+
|
|
31
|
+
def create(
|
|
32
|
+
self, *, name: str, mcp_server_url: str, request_options: typing.Optional[RequestOptions] = None
|
|
33
|
+
) -> McpServerResponse:
|
|
34
|
+
"""
|
|
35
|
+
Creates a new MCP server
|
|
36
|
+
|
|
37
|
+
Parameters
|
|
38
|
+
----------
|
|
39
|
+
name : str
|
|
40
|
+
Name of the MCP server
|
|
41
|
+
|
|
42
|
+
mcp_server_url : str
|
|
43
|
+
URL of the MCP server
|
|
44
|
+
|
|
45
|
+
request_options : typing.Optional[RequestOptions]
|
|
46
|
+
Request-specific configuration.
|
|
47
|
+
|
|
48
|
+
Returns
|
|
49
|
+
-------
|
|
50
|
+
McpServerResponse
|
|
51
|
+
Successfully created MCP server
|
|
52
|
+
|
|
53
|
+
Examples
|
|
54
|
+
--------
|
|
55
|
+
from phenoml import phenoml
|
|
56
|
+
|
|
57
|
+
client = phenoml(
|
|
58
|
+
token="YOUR_TOKEN",
|
|
59
|
+
)
|
|
60
|
+
client.tools.mcp_server.create(
|
|
61
|
+
name="My MCP Server",
|
|
62
|
+
mcp_server_url="https://mcp.example.com",
|
|
63
|
+
)
|
|
64
|
+
"""
|
|
65
|
+
_response = self._raw_client.create(name=name, mcp_server_url=mcp_server_url, request_options=request_options)
|
|
66
|
+
return _response.data
|
|
67
|
+
|
|
68
|
+
def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> McpServerResponse:
|
|
69
|
+
"""
|
|
70
|
+
Lists all MCP servers for a specific user
|
|
71
|
+
|
|
72
|
+
Parameters
|
|
73
|
+
----------
|
|
74
|
+
request_options : typing.Optional[RequestOptions]
|
|
75
|
+
Request-specific configuration.
|
|
76
|
+
|
|
77
|
+
Returns
|
|
78
|
+
-------
|
|
79
|
+
McpServerResponse
|
|
80
|
+
Successfully listed MCP servers
|
|
81
|
+
|
|
82
|
+
Examples
|
|
83
|
+
--------
|
|
84
|
+
from phenoml import phenoml
|
|
85
|
+
|
|
86
|
+
client = phenoml(
|
|
87
|
+
token="YOUR_TOKEN",
|
|
88
|
+
)
|
|
89
|
+
client.tools.mcp_server.list()
|
|
90
|
+
"""
|
|
91
|
+
_response = self._raw_client.list(request_options=request_options)
|
|
92
|
+
return _response.data
|
|
93
|
+
|
|
94
|
+
def get(self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> McpServerResponse:
|
|
95
|
+
"""
|
|
96
|
+
Gets a MCP server by ID
|
|
97
|
+
|
|
98
|
+
Parameters
|
|
99
|
+
----------
|
|
100
|
+
mcp_server_id : str
|
|
101
|
+
ID of the MCP server to retrieve
|
|
102
|
+
|
|
103
|
+
request_options : typing.Optional[RequestOptions]
|
|
104
|
+
Request-specific configuration.
|
|
105
|
+
|
|
106
|
+
Returns
|
|
107
|
+
-------
|
|
108
|
+
McpServerResponse
|
|
109
|
+
Successfully retrieved MCP server
|
|
110
|
+
|
|
111
|
+
Examples
|
|
112
|
+
--------
|
|
113
|
+
from phenoml import phenoml
|
|
114
|
+
|
|
115
|
+
client = phenoml(
|
|
116
|
+
token="YOUR_TOKEN",
|
|
117
|
+
)
|
|
118
|
+
client.tools.mcp_server.get(
|
|
119
|
+
mcp_server_id="mcp_server_id",
|
|
120
|
+
)
|
|
121
|
+
"""
|
|
122
|
+
_response = self._raw_client.get(mcp_server_id, request_options=request_options)
|
|
123
|
+
return _response.data
|
|
124
|
+
|
|
125
|
+
def delete(
|
|
126
|
+
self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
127
|
+
) -> McpServerResponse:
|
|
128
|
+
"""
|
|
129
|
+
Deletes a MCP server by ID
|
|
130
|
+
|
|
131
|
+
Parameters
|
|
132
|
+
----------
|
|
133
|
+
mcp_server_id : str
|
|
134
|
+
ID of the MCP server to delete
|
|
135
|
+
|
|
136
|
+
request_options : typing.Optional[RequestOptions]
|
|
137
|
+
Request-specific configuration.
|
|
138
|
+
|
|
139
|
+
Returns
|
|
140
|
+
-------
|
|
141
|
+
McpServerResponse
|
|
142
|
+
Successfully deleted MCP server
|
|
143
|
+
|
|
144
|
+
Examples
|
|
145
|
+
--------
|
|
146
|
+
from phenoml import phenoml
|
|
147
|
+
|
|
148
|
+
client = phenoml(
|
|
149
|
+
token="YOUR_TOKEN",
|
|
150
|
+
)
|
|
151
|
+
client.tools.mcp_server.delete(
|
|
152
|
+
mcp_server_id="mcp_server_id",
|
|
153
|
+
)
|
|
154
|
+
"""
|
|
155
|
+
_response = self._raw_client.delete(mcp_server_id, request_options=request_options)
|
|
156
|
+
return _response.data
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class AsyncMcpServerClient:
|
|
160
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
161
|
+
self._raw_client = AsyncRawMcpServerClient(client_wrapper=client_wrapper)
|
|
162
|
+
self.tools = AsyncToolsClient(client_wrapper=client_wrapper)
|
|
163
|
+
|
|
164
|
+
@property
|
|
165
|
+
def with_raw_response(self) -> AsyncRawMcpServerClient:
|
|
166
|
+
"""
|
|
167
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
168
|
+
|
|
169
|
+
Returns
|
|
170
|
+
-------
|
|
171
|
+
AsyncRawMcpServerClient
|
|
172
|
+
"""
|
|
173
|
+
return self._raw_client
|
|
174
|
+
|
|
175
|
+
async def create(
|
|
176
|
+
self, *, name: str, mcp_server_url: str, request_options: typing.Optional[RequestOptions] = None
|
|
177
|
+
) -> McpServerResponse:
|
|
178
|
+
"""
|
|
179
|
+
Creates a new MCP server
|
|
180
|
+
|
|
181
|
+
Parameters
|
|
182
|
+
----------
|
|
183
|
+
name : str
|
|
184
|
+
Name of the MCP server
|
|
185
|
+
|
|
186
|
+
mcp_server_url : str
|
|
187
|
+
URL of the MCP server
|
|
188
|
+
|
|
189
|
+
request_options : typing.Optional[RequestOptions]
|
|
190
|
+
Request-specific configuration.
|
|
191
|
+
|
|
192
|
+
Returns
|
|
193
|
+
-------
|
|
194
|
+
McpServerResponse
|
|
195
|
+
Successfully created MCP server
|
|
196
|
+
|
|
197
|
+
Examples
|
|
198
|
+
--------
|
|
199
|
+
import asyncio
|
|
200
|
+
|
|
201
|
+
from phenoml import Asyncphenoml
|
|
202
|
+
|
|
203
|
+
client = Asyncphenoml(
|
|
204
|
+
token="YOUR_TOKEN",
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
async def main() -> None:
|
|
209
|
+
await client.tools.mcp_server.create(
|
|
210
|
+
name="My MCP Server",
|
|
211
|
+
mcp_server_url="https://mcp.example.com",
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
asyncio.run(main())
|
|
216
|
+
"""
|
|
217
|
+
_response = await self._raw_client.create(
|
|
218
|
+
name=name, mcp_server_url=mcp_server_url, request_options=request_options
|
|
219
|
+
)
|
|
220
|
+
return _response.data
|
|
221
|
+
|
|
222
|
+
async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> McpServerResponse:
|
|
223
|
+
"""
|
|
224
|
+
Lists all MCP servers for a specific user
|
|
225
|
+
|
|
226
|
+
Parameters
|
|
227
|
+
----------
|
|
228
|
+
request_options : typing.Optional[RequestOptions]
|
|
229
|
+
Request-specific configuration.
|
|
230
|
+
|
|
231
|
+
Returns
|
|
232
|
+
-------
|
|
233
|
+
McpServerResponse
|
|
234
|
+
Successfully listed MCP servers
|
|
235
|
+
|
|
236
|
+
Examples
|
|
237
|
+
--------
|
|
238
|
+
import asyncio
|
|
239
|
+
|
|
240
|
+
from phenoml import Asyncphenoml
|
|
241
|
+
|
|
242
|
+
client = Asyncphenoml(
|
|
243
|
+
token="YOUR_TOKEN",
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
async def main() -> None:
|
|
248
|
+
await client.tools.mcp_server.list()
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
asyncio.run(main())
|
|
252
|
+
"""
|
|
253
|
+
_response = await self._raw_client.list(request_options=request_options)
|
|
254
|
+
return _response.data
|
|
255
|
+
|
|
256
|
+
async def get(
|
|
257
|
+
self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
258
|
+
) -> McpServerResponse:
|
|
259
|
+
"""
|
|
260
|
+
Gets a MCP server by ID
|
|
261
|
+
|
|
262
|
+
Parameters
|
|
263
|
+
----------
|
|
264
|
+
mcp_server_id : str
|
|
265
|
+
ID of the MCP server to retrieve
|
|
266
|
+
|
|
267
|
+
request_options : typing.Optional[RequestOptions]
|
|
268
|
+
Request-specific configuration.
|
|
269
|
+
|
|
270
|
+
Returns
|
|
271
|
+
-------
|
|
272
|
+
McpServerResponse
|
|
273
|
+
Successfully retrieved MCP server
|
|
274
|
+
|
|
275
|
+
Examples
|
|
276
|
+
--------
|
|
277
|
+
import asyncio
|
|
278
|
+
|
|
279
|
+
from phenoml import Asyncphenoml
|
|
280
|
+
|
|
281
|
+
client = Asyncphenoml(
|
|
282
|
+
token="YOUR_TOKEN",
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
async def main() -> None:
|
|
287
|
+
await client.tools.mcp_server.get(
|
|
288
|
+
mcp_server_id="mcp_server_id",
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
asyncio.run(main())
|
|
293
|
+
"""
|
|
294
|
+
_response = await self._raw_client.get(mcp_server_id, request_options=request_options)
|
|
295
|
+
return _response.data
|
|
296
|
+
|
|
297
|
+
async def delete(
|
|
298
|
+
self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
299
|
+
) -> McpServerResponse:
|
|
300
|
+
"""
|
|
301
|
+
Deletes a MCP server by ID
|
|
302
|
+
|
|
303
|
+
Parameters
|
|
304
|
+
----------
|
|
305
|
+
mcp_server_id : str
|
|
306
|
+
ID of the MCP server to delete
|
|
307
|
+
|
|
308
|
+
request_options : typing.Optional[RequestOptions]
|
|
309
|
+
Request-specific configuration.
|
|
310
|
+
|
|
311
|
+
Returns
|
|
312
|
+
-------
|
|
313
|
+
McpServerResponse
|
|
314
|
+
Successfully deleted MCP server
|
|
315
|
+
|
|
316
|
+
Examples
|
|
317
|
+
--------
|
|
318
|
+
import asyncio
|
|
319
|
+
|
|
320
|
+
from phenoml import Asyncphenoml
|
|
321
|
+
|
|
322
|
+
client = Asyncphenoml(
|
|
323
|
+
token="YOUR_TOKEN",
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
async def main() -> None:
|
|
328
|
+
await client.tools.mcp_server.delete(
|
|
329
|
+
mcp_server_id="mcp_server_id",
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
asyncio.run(main())
|
|
334
|
+
"""
|
|
335
|
+
_response = await self._raw_client.delete(mcp_server_id, request_options=request_options)
|
|
336
|
+
return _response.data
|