universal-mcp 0.1.8rc1__py3-none-any.whl → 0.1.8rc2__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.
- universal_mcp/applications/application.py +6 -5
- universal_mcp/applications/calendly/README.md +78 -0
- universal_mcp/applications/calendly/app.py +954 -0
- universal_mcp/applications/e2b/app.py +18 -12
- universal_mcp/applications/firecrawl/app.py +28 -1
- universal_mcp/applications/github/app.py +150 -107
- universal_mcp/applications/google_calendar/app.py +72 -137
- universal_mcp/applications/google_docs/app.py +35 -15
- universal_mcp/applications/google_drive/app.py +84 -55
- universal_mcp/applications/google_mail/app.py +143 -53
- universal_mcp/applications/google_sheet/app.py +61 -38
- universal_mcp/applications/markitdown/app.py +12 -11
- universal_mcp/applications/notion/app.py +199 -89
- universal_mcp/applications/perplexity/app.py +17 -15
- universal_mcp/applications/reddit/app.py +110 -101
- universal_mcp/applications/resend/app.py +14 -7
- universal_mcp/applications/serpapi/app.py +13 -6
- universal_mcp/applications/tavily/app.py +13 -10
- universal_mcp/applications/wrike/README.md +71 -0
- universal_mcp/applications/wrike/__init__.py +0 -0
- universal_mcp/applications/wrike/app.py +1044 -0
- universal_mcp/applications/youtube/README.md +82 -0
- universal_mcp/applications/youtube/__init__.py +0 -0
- universal_mcp/applications/youtube/app.py +986 -0
- universal_mcp/applications/zenquotes/app.py +13 -3
- universal_mcp/exceptions.py +8 -2
- universal_mcp/integrations/__init__.py +15 -1
- universal_mcp/integrations/integration.py +132 -27
- universal_mcp/servers/__init__.py +6 -15
- universal_mcp/servers/server.py +209 -153
- universal_mcp/stores/__init__.py +7 -2
- universal_mcp/stores/store.py +103 -42
- universal_mcp/tools/__init__.py +3 -0
- universal_mcp/tools/adapters.py +40 -0
- universal_mcp/tools/func_metadata.py +214 -0
- universal_mcp/tools/tools.py +285 -0
- universal_mcp/utils/docgen.py +277 -123
- universal_mcp/utils/docstring_parser.py +156 -0
- universal_mcp/utils/openapi.py +149 -40
- {universal_mcp-0.1.8rc1.dist-info → universal_mcp-0.1.8rc2.dist-info}/METADATA +7 -3
- universal_mcp-0.1.8rc2.dist-info/RECORD +71 -0
- universal_mcp-0.1.8rc1.dist-info/RECORD +0 -58
- /universal_mcp/{utils/bridge.py → applications/calendly/__init__.py} +0 -0
- {universal_mcp-0.1.8rc1.dist-info → universal_mcp-0.1.8rc2.dist-info}/WHEEL +0 -0
- {universal_mcp-0.1.8rc1.dist-info → universal_mcp-0.1.8rc2.dist-info}/entry_points.txt +0 -0
@@ -6,16 +6,6 @@ from universal_mcp.integrations import Integration
|
|
6
6
|
|
7
7
|
class NotionApp(APIApplication):
|
8
8
|
def __init__(self, integration: Integration = None, **kwargs) -> None:
|
9
|
-
"""
|
10
|
-
Initializes a new instance of the Notion API app with a specified integration and additional parameters.
|
11
|
-
|
12
|
-
Args:
|
13
|
-
integration: Optional; an Integration object containing credentials for authenticating with the Notion API. Defaults to None.
|
14
|
-
kwargs: Additional keyword arguments that are passed to the parent class initializer.
|
15
|
-
|
16
|
-
Returns:
|
17
|
-
None
|
18
|
-
"""
|
19
9
|
super().__init__(name='notion', integration=integration, **kwargs)
|
20
10
|
self.base_url = "https://api.notion.com"
|
21
11
|
|
@@ -33,15 +23,21 @@ class NotionApp(APIApplication):
|
|
33
23
|
|
34
24
|
def retrieve_a_user(self, id, request_body=None) -> dict[str, Any]:
|
35
25
|
"""
|
36
|
-
Retrieves user details from the server using
|
26
|
+
Retrieves a user's details from the server using their unique identifier.
|
37
27
|
|
38
28
|
Args:
|
39
|
-
|
40
|
-
|
41
|
-
request_body: Optional request body data, provided when needed. Default is None.
|
29
|
+
id: The unique identifier of the user to retrieve
|
30
|
+
request_body: Optional request body data for the request. Defaults to None
|
42
31
|
|
43
32
|
Returns:
|
44
|
-
A dictionary containing user details
|
33
|
+
A dictionary containing user details retrieved from the server response
|
34
|
+
|
35
|
+
Raises:
|
36
|
+
ValueError: Raised when the 'id' parameter is None
|
37
|
+
requests.exceptions.HTTPError: Raised when the server returns an unsuccessful status code
|
38
|
+
|
39
|
+
Tags:
|
40
|
+
retrieve, get, user, api, single-record, important
|
45
41
|
"""
|
46
42
|
if id is None:
|
47
43
|
raise ValueError("Missing required parameter 'id'")
|
@@ -53,13 +49,20 @@ class NotionApp(APIApplication):
|
|
53
49
|
|
54
50
|
def list_all_users(self, ) -> dict[str, Any]:
|
55
51
|
"""
|
56
|
-
|
52
|
+
Retrieves a complete list of users from the API endpoint.
|
57
53
|
|
58
54
|
Args:
|
59
55
|
None: This method does not take any parameters.
|
60
56
|
|
61
57
|
Returns:
|
62
|
-
A dictionary containing
|
58
|
+
dict[str, Any]: A dictionary containing user data where keys are strings and values can be of any type, representing user information retrieved from the API.
|
59
|
+
|
60
|
+
Raises:
|
61
|
+
HTTPError: Raised when the API request fails or returns a non-200 status code
|
62
|
+
RequestException: Raised when there are network connectivity issues or other request-related problems
|
63
|
+
|
64
|
+
Tags:
|
65
|
+
list, users, api, fetch, management, important
|
63
66
|
"""
|
64
67
|
url = f"{self.base_url}/v1/users"
|
65
68
|
query_params = {}
|
@@ -69,13 +72,17 @@ class NotionApp(APIApplication):
|
|
69
72
|
|
70
73
|
def retrieve_your_token_sbot_user(self, ) -> dict[str, Any]:
|
71
74
|
"""
|
72
|
-
Retrieves the authentication token
|
73
|
-
|
74
|
-
Args:
|
75
|
-
self: Instance of the class containing configuration such as 'base_url' and the '_get' method.
|
75
|
+
Retrieves the current user's authentication token information from the SBOT service.
|
76
76
|
|
77
77
|
Returns:
|
78
|
-
A dictionary containing the
|
78
|
+
A dictionary containing the authentication token and related user information from the JSON response.
|
79
|
+
|
80
|
+
Raises:
|
81
|
+
requests.exceptions.HTTPError: When the API request fails or returns a non-200 status code
|
82
|
+
requests.exceptions.RequestException: When there are network connectivity issues or other request-related problems
|
83
|
+
|
84
|
+
Tags:
|
85
|
+
retrieve, authentication, token, user, api, important
|
79
86
|
"""
|
80
87
|
url = f"{self.base_url}/v1/users/me"
|
81
88
|
query_params = {}
|
@@ -85,13 +92,20 @@ class NotionApp(APIApplication):
|
|
85
92
|
|
86
93
|
def retrieve_a_database(self, id) -> dict[str, Any]:
|
87
94
|
"""
|
88
|
-
Retrieves
|
95
|
+
Retrieves detailed information about a specific database using its unique identifier.
|
89
96
|
|
90
97
|
Args:
|
91
|
-
id:
|
98
|
+
id: Unique identifier for the database to retrieve. Must be a non-null value.
|
92
99
|
|
93
100
|
Returns:
|
94
|
-
A dictionary containing
|
101
|
+
A dictionary containing detailed information about the requested database.
|
102
|
+
|
103
|
+
Raises:
|
104
|
+
ValueError: Raised when the 'id' parameter is None
|
105
|
+
HTTPError: Raised when the API request fails or returns an error status code
|
106
|
+
|
107
|
+
Tags:
|
108
|
+
retrieve, get, database, api, data-access, important
|
95
109
|
"""
|
96
110
|
if id is None:
|
97
111
|
raise ValueError("Missing required parameter 'id'")
|
@@ -103,15 +117,21 @@ class NotionApp(APIApplication):
|
|
103
117
|
|
104
118
|
def update_a_database(self, id, request_body=None) -> dict[str, Any]:
|
105
119
|
"""
|
106
|
-
Updates a database entry with the
|
120
|
+
Updates a database entry with the specified ID using a PATCH request.
|
107
121
|
|
108
122
|
Args:
|
109
|
-
|
110
|
-
|
111
|
-
request_body: An optional dictionary containing the data to update the database entry with. Defaults to None.
|
123
|
+
id: The unique identifier of the database entry to update.
|
124
|
+
request_body: Optional dictionary containing the fields and values to update. Defaults to None.
|
112
125
|
|
113
126
|
Returns:
|
114
|
-
A dictionary
|
127
|
+
dict[str, Any]: A dictionary containing the server's JSON response after the update operation.
|
128
|
+
|
129
|
+
Raises:
|
130
|
+
ValueError: When the 'id' parameter is None.
|
131
|
+
requests.exceptions.HTTPError: When the server returns an unsuccessful status code.
|
132
|
+
|
133
|
+
Tags:
|
134
|
+
update, database, patch, important, api, management
|
115
135
|
"""
|
116
136
|
if id is None:
|
117
137
|
raise ValueError("Missing required parameter 'id'")
|
@@ -123,14 +143,21 @@ class NotionApp(APIApplication):
|
|
123
143
|
|
124
144
|
def query_a_database(self, id, request_body=None) -> dict[str, Any]:
|
125
145
|
"""
|
126
|
-
Executes a query
|
146
|
+
Executes a database query operation using a specified database ID and optional request parameters
|
127
147
|
|
128
148
|
Args:
|
129
|
-
id: The unique identifier of the database to query
|
130
|
-
request_body: Optional JSON-compatible dictionary representing the body of the query request; if None, no additional query data is sent
|
149
|
+
id: The unique identifier of the database to query
|
150
|
+
request_body: Optional JSON-compatible dictionary representing the body of the query request; if None, no additional query data is sent
|
131
151
|
|
132
152
|
Returns:
|
133
|
-
A dictionary containing the response data from the database query as parsed from JSON
|
153
|
+
A dictionary containing the response data from the database query as parsed from JSON
|
154
|
+
|
155
|
+
Raises:
|
156
|
+
ValueError: Raised when the required 'id' parameter is None
|
157
|
+
HTTPError: Raised when the HTTP request fails or returns an error status code
|
158
|
+
|
159
|
+
Tags:
|
160
|
+
query, database, api, data-retrieval, http, important
|
134
161
|
"""
|
135
162
|
if id is None:
|
136
163
|
raise ValueError("Missing required parameter 'id'")
|
@@ -142,13 +169,21 @@ class NotionApp(APIApplication):
|
|
142
169
|
|
143
170
|
def create_a_database(self, request_body=None) -> dict[str, Any]:
|
144
171
|
"""
|
145
|
-
Creates a new database on the server
|
172
|
+
Creates a new database on the server by sending a POST request to the database endpoint.
|
146
173
|
|
147
174
|
Args:
|
148
|
-
request_body:
|
175
|
+
request_body: Optional dictionary containing configuration parameters for the new database. Defaults to None.
|
149
176
|
|
150
177
|
Returns:
|
151
|
-
A dictionary containing the server's JSON response
|
178
|
+
A dictionary containing the server's JSON response with details of the created database.
|
179
|
+
|
180
|
+
Raises:
|
181
|
+
HTTPError: Raised when the server returns a non-200 status code indicating database creation failure
|
182
|
+
RequestException: Raised when network connectivity issues occur during the API request
|
183
|
+
JSONDecodeError: Raised when the server response cannot be parsed as valid JSON
|
184
|
+
|
185
|
+
Tags:
|
186
|
+
create, database, api, management, important
|
152
187
|
"""
|
153
188
|
url = f"{self.base_url}/v1/databases/"
|
154
189
|
query_params = {}
|
@@ -158,13 +193,20 @@ class NotionApp(APIApplication):
|
|
158
193
|
|
159
194
|
def create_a_page(self, request_body=None) -> dict[str, Any]:
|
160
195
|
"""
|
161
|
-
Creates a new page by sending a POST request to the
|
196
|
+
Creates a new page by sending a POST request to the API endpoint.
|
162
197
|
|
163
198
|
Args:
|
164
|
-
request_body: Optional
|
199
|
+
request_body: Optional dictionary containing the page data to be sent in the POST request body. Defaults to None.
|
165
200
|
|
166
201
|
Returns:
|
167
|
-
|
202
|
+
Dictionary containing the JSON response from the server with details of the newly created page.
|
203
|
+
|
204
|
+
Raises:
|
205
|
+
HTTPError: When the server returns a non-200 status code, indicating a failed request
|
206
|
+
RequestException: When network-related issues occur during the API request
|
207
|
+
|
208
|
+
Tags:
|
209
|
+
create, page, api, http, post, important
|
168
210
|
"""
|
169
211
|
url = f"{self.base_url}/v1/pages/"
|
170
212
|
query_params = {}
|
@@ -174,13 +216,20 @@ class NotionApp(APIApplication):
|
|
174
216
|
|
175
217
|
def retrieve_a_page(self, id) -> dict[str, Any]:
|
176
218
|
"""
|
177
|
-
Retrieves a page
|
219
|
+
Retrieves a specific page's data from a remote server using its unique identifier.
|
178
220
|
|
179
221
|
Args:
|
180
|
-
id: The unique identifier of the page to retrieve
|
222
|
+
id: The unique identifier of the page to retrieve
|
181
223
|
|
182
224
|
Returns:
|
183
|
-
A dictionary containing the
|
225
|
+
A dictionary containing the page data returned from the server's JSON response
|
226
|
+
|
227
|
+
Raises:
|
228
|
+
ValueError: When the 'id' parameter is None
|
229
|
+
HTTPError: When the server returns an unsuccessful status code
|
230
|
+
|
231
|
+
Tags:
|
232
|
+
retrieve, fetch, api, http, get, page, important
|
184
233
|
"""
|
185
234
|
if id is None:
|
186
235
|
raise ValueError("Missing required parameter 'id'")
|
@@ -192,14 +241,22 @@ class NotionApp(APIApplication):
|
|
192
241
|
|
193
242
|
def update_page_properties(self, id, request_body=None) -> dict[str, Any]:
|
194
243
|
"""
|
195
|
-
Updates the properties of a page
|
244
|
+
Updates the properties of a page with the specified ID using the provided request body.
|
196
245
|
|
197
246
|
Args:
|
198
|
-
id: The unique identifier of the page
|
199
|
-
request_body:
|
247
|
+
id: The unique identifier of the page to update. Must not be None.
|
248
|
+
request_body: Optional dictionary containing the properties to be updated. Defaults to None.
|
200
249
|
|
201
250
|
Returns:
|
202
|
-
|
251
|
+
Dictionary containing the updated page properties as returned by the server.
|
252
|
+
|
253
|
+
Raises:
|
254
|
+
ValueError: When the required 'id' parameter is None
|
255
|
+
HTTPError: When the server returns an unsuccessful status code
|
256
|
+
RequestException: When there is an error making the HTTP request
|
257
|
+
|
258
|
+
Tags:
|
259
|
+
update, api, page-management, http, important
|
203
260
|
"""
|
204
261
|
if id is None:
|
205
262
|
raise ValueError("Missing required parameter 'id'")
|
@@ -211,14 +268,21 @@ class NotionApp(APIApplication):
|
|
211
268
|
|
212
269
|
def retrieve_a_page_property_item(self, page_id, property_id) -> dict[str, Any]:
|
213
270
|
"""
|
214
|
-
Retrieves
|
271
|
+
Retrieves a specific property item from a Notion page using the page ID and property ID.
|
215
272
|
|
216
273
|
Args:
|
217
|
-
page_id: The unique identifier of the page from which the property
|
218
|
-
property_id: The unique identifier of the property
|
274
|
+
page_id: The unique identifier of the Notion page from which to retrieve the property
|
275
|
+
property_id: The unique identifier of the specific property to retrieve
|
219
276
|
|
220
277
|
Returns:
|
221
|
-
A dictionary
|
278
|
+
A dictionary containing the property item's details from the API response
|
279
|
+
|
280
|
+
Raises:
|
281
|
+
ValueError: When either page_id or property_id is None
|
282
|
+
HTTPError: When the API request fails or returns an error status code
|
283
|
+
|
284
|
+
Tags:
|
285
|
+
retrieve, get, property, page, api, notion, important
|
222
286
|
"""
|
223
287
|
if page_id is None:
|
224
288
|
raise ValueError("Missing required parameter 'page_id'")
|
@@ -232,14 +296,21 @@ class NotionApp(APIApplication):
|
|
232
296
|
|
233
297
|
def retrieve_block_children(self, id, page_size=None) -> dict[str, Any]:
|
234
298
|
"""
|
235
|
-
Retrieves
|
299
|
+
Retrieves all child blocks for a specified parent block using its ID via the API.
|
236
300
|
|
237
301
|
Args:
|
238
|
-
id: The unique identifier of the block whose children are to be retrieved
|
239
|
-
page_size: Optional
|
302
|
+
id: The unique identifier of the parent block whose children are to be retrieved
|
303
|
+
page_size: Optional integer specifying the maximum number of children to return per page in the response
|
240
304
|
|
241
305
|
Returns:
|
242
|
-
A dictionary containing the data
|
306
|
+
A dictionary containing the API response data with the children blocks information
|
307
|
+
|
308
|
+
Raises:
|
309
|
+
ValueError: When the required 'id' parameter is None
|
310
|
+
HTTPError: When the API request fails or returns an error status code
|
311
|
+
|
312
|
+
Tags:
|
313
|
+
retrieve, list, blocks, children, pagination, api-call, important
|
243
314
|
"""
|
244
315
|
if id is None:
|
245
316
|
raise ValueError("Missing required parameter 'id'")
|
@@ -251,15 +322,21 @@ class NotionApp(APIApplication):
|
|
251
322
|
|
252
323
|
def append_block_children(self, id, request_body=None) -> dict[str, Any]:
|
253
324
|
"""
|
254
|
-
Appends child elements to a block
|
325
|
+
Appends child elements to a specified block and returns the updated block data.
|
255
326
|
|
256
327
|
Args:
|
257
|
-
|
258
|
-
|
259
|
-
request_body: Optional dictionary containing the data of the child elements to be appended to the block.
|
328
|
+
id: String identifier of the block to which children will be appended
|
329
|
+
request_body: Optional dictionary containing the child elements to be appended (default: None)
|
260
330
|
|
261
331
|
Returns:
|
262
|
-
A dictionary
|
332
|
+
dict[str, Any]: A dictionary containing the updated block data after appending the children
|
333
|
+
|
334
|
+
Raises:
|
335
|
+
ValueError: When the required 'id' parameter is None
|
336
|
+
HTTPError: When the API request fails or returns an error status code
|
337
|
+
|
338
|
+
Tags:
|
339
|
+
append, update, blocks, children, api, important
|
263
340
|
"""
|
264
341
|
if id is None:
|
265
342
|
raise ValueError("Missing required parameter 'id'")
|
@@ -271,13 +348,20 @@ class NotionApp(APIApplication):
|
|
271
348
|
|
272
349
|
def retrieve_a_block(self, id) -> dict[str, Any]:
|
273
350
|
"""
|
274
|
-
Retrieves a block of data from
|
351
|
+
Retrieves a specific block of data from the API using its unique identifier.
|
275
352
|
|
276
353
|
Args:
|
277
|
-
id: The unique identifier for the block to be retrieved.
|
354
|
+
id: The unique identifier for the block to be retrieved. Must be a non-None value.
|
278
355
|
|
279
356
|
Returns:
|
280
|
-
A dictionary containing the
|
357
|
+
A dictionary containing the block data retrieved from the API, parsed from the JSON response.
|
358
|
+
|
359
|
+
Raises:
|
360
|
+
ValueError: When the 'id' parameter is None
|
361
|
+
HTTPError: When the API request fails or returns an error status code
|
362
|
+
|
363
|
+
Tags:
|
364
|
+
retrieve, fetch, api, data, block, single, important
|
281
365
|
"""
|
282
366
|
if id is None:
|
283
367
|
raise ValueError("Missing required parameter 'id'")
|
@@ -289,13 +373,20 @@ class NotionApp(APIApplication):
|
|
289
373
|
|
290
374
|
def delete_a_block(self, id) -> dict[str, Any]:
|
291
375
|
"""
|
292
|
-
Deletes a block by its
|
376
|
+
Deletes a specified block by its ID and returns the server response.
|
293
377
|
|
294
378
|
Args:
|
295
379
|
id: The unique identifier of the block to be deleted. Must not be None.
|
296
380
|
|
297
381
|
Returns:
|
298
|
-
A dictionary containing the response data
|
382
|
+
A dictionary containing the server's response data after the deletion operation.
|
383
|
+
|
384
|
+
Raises:
|
385
|
+
ValueError: When the 'id' parameter is None
|
386
|
+
HTTPError: When the server returns an unsuccessful status code
|
387
|
+
|
388
|
+
Tags:
|
389
|
+
delete, important, management, api, http, block-management
|
299
390
|
"""
|
300
391
|
if id is None:
|
301
392
|
raise ValueError("Missing required parameter 'id'")
|
@@ -307,14 +398,21 @@ class NotionApp(APIApplication):
|
|
307
398
|
|
308
399
|
def update_a_block(self, id, request_body=None) -> dict[str, Any]:
|
309
400
|
"""
|
310
|
-
Updates a block
|
401
|
+
Updates a specific block resource via a PATCH request to the API endpoint
|
311
402
|
|
312
403
|
Args:
|
313
|
-
id: The unique identifier
|
314
|
-
request_body: Optional
|
404
|
+
id: The unique identifier of the block to update
|
405
|
+
request_body: Optional dictionary containing the update data for the block. Defaults to None
|
315
406
|
|
316
407
|
Returns:
|
317
|
-
|
408
|
+
Dictionary containing the server's JSON response with the updated block information
|
409
|
+
|
410
|
+
Raises:
|
411
|
+
ValueError: When the required 'id' parameter is None
|
412
|
+
HTTPError: When the server responds with an error status code
|
413
|
+
|
414
|
+
Tags:
|
415
|
+
update, patch, api, block-management, important
|
318
416
|
"""
|
319
417
|
if id is None:
|
320
418
|
raise ValueError("Missing required parameter 'id'")
|
@@ -326,13 +424,20 @@ class NotionApp(APIApplication):
|
|
326
424
|
|
327
425
|
def search(self, request_body=None) -> dict[str, Any]:
|
328
426
|
"""
|
329
|
-
Executes a search
|
427
|
+
Executes a search operation by sending a POST request to the search endpoint and returns the results
|
330
428
|
|
331
429
|
Args:
|
332
|
-
request_body:
|
430
|
+
request_body: Optional dictionary containing the search parameters and filters to be sent in the request. Defaults to None.
|
333
431
|
|
334
432
|
Returns:
|
335
|
-
A dictionary containing the JSON
|
433
|
+
A dictionary containing the parsed JSON response from the search operation with search results and metadata
|
434
|
+
|
435
|
+
Raises:
|
436
|
+
HTTPError: Raised when the search request fails or returns a non-200 status code
|
437
|
+
JSONDecodeError: Raised when the response cannot be parsed as valid JSON
|
438
|
+
|
439
|
+
Tags:
|
440
|
+
search, important, http, query, api-request, json
|
336
441
|
"""
|
337
442
|
url = f"{self.base_url}/v1/search"
|
338
443
|
query_params = {}
|
@@ -342,15 +447,22 @@ class NotionApp(APIApplication):
|
|
342
447
|
|
343
448
|
def retrieve_comments(self, block_id=None, page_size=None, request_body=None) -> dict[str, Any]:
|
344
449
|
"""
|
345
|
-
|
450
|
+
Retrieves comments from a remote server with optional block filtering and pagination support.
|
346
451
|
|
347
452
|
Args:
|
348
|
-
block_id: Optional
|
349
|
-
page_size: Optional
|
350
|
-
request_body:
|
453
|
+
block_id: Optional string or ID that specifies which block's comments to retrieve. If None, retrieves all comments.
|
454
|
+
page_size: Optional integer specifying the number of comments to return per page. If None, uses server's default pagination.
|
455
|
+
request_body: Optional dictionary for future extensibility. Currently unused.
|
351
456
|
|
352
457
|
Returns:
|
353
|
-
|
458
|
+
Dictionary containing comment data parsed from the server's JSON response.
|
459
|
+
|
460
|
+
Raises:
|
461
|
+
HTTPError: Raised when the server returns a non-200 status code
|
462
|
+
RequestException: Raised for network-related errors during the HTTP request
|
463
|
+
|
464
|
+
Tags:
|
465
|
+
retrieve, fetch, comments, api, pagination, http, important
|
354
466
|
"""
|
355
467
|
url = f"{self.base_url}/v1/comments"
|
356
468
|
query_params = {k: v for k, v in [('block_id', block_id), ('page_size', page_size)] if v is not None}
|
@@ -360,13 +472,20 @@ class NotionApp(APIApplication):
|
|
360
472
|
|
361
473
|
def add_comment_to_page(self, request_body=None) -> dict[str, Any]:
|
362
474
|
"""
|
363
|
-
Adds a comment to a page by
|
475
|
+
Adds a comment to a page by making an HTTP POST request to the comments endpoint.
|
364
476
|
|
365
477
|
Args:
|
366
|
-
request_body: Optional
|
478
|
+
request_body: Optional dictionary containing the comment data to be posted. If None, an empty comment will be created. Defaults to None.
|
367
479
|
|
368
480
|
Returns:
|
369
|
-
|
481
|
+
Dictionary containing the server's JSON response with details of the created comment.
|
482
|
+
|
483
|
+
Raises:
|
484
|
+
HTTPError: Raised when the server returns a non-200 status code, indicating the comment creation failed.
|
485
|
+
RequestException: Raised when there are network connectivity issues or other request-related problems.
|
486
|
+
|
487
|
+
Tags:
|
488
|
+
add, create, comment, post, api, content-management, important
|
370
489
|
"""
|
371
490
|
url = f"{self.base_url}/v1/comments"
|
372
491
|
query_params = {}
|
@@ -375,15 +494,6 @@ class NotionApp(APIApplication):
|
|
375
494
|
return response.json()
|
376
495
|
|
377
496
|
def list_tools(self):
|
378
|
-
"""
|
379
|
-
Returns a list of functions related to user and database operations.
|
380
|
-
|
381
|
-
Args:
|
382
|
-
self: The instance of the class to which the function belongs.
|
383
|
-
|
384
|
-
Returns:
|
385
|
-
A list of method references that pertain to various operations such as user retrieval, database operations, and page/block management.
|
386
|
-
"""
|
387
497
|
return [
|
388
498
|
self.retrieve_a_user,
|
389
499
|
self.list_all_users,
|
@@ -1,8 +1,9 @@
|
|
1
1
|
from typing import Any, Literal
|
2
2
|
|
3
|
+
from loguru import logger
|
4
|
+
|
3
5
|
from universal_mcp.applications.application import APIApplication
|
4
6
|
from universal_mcp.integrations import Integration
|
5
|
-
from loguru import logger
|
6
7
|
|
7
8
|
|
8
9
|
class PerplexityApp(APIApplication):
|
@@ -58,34 +59,35 @@ class PerplexityApp(APIApplication):
|
|
58
59
|
system_prompt: str = "Be precise and concise.",
|
59
60
|
) -> dict[str, Any] | str:
|
60
61
|
"""
|
61
|
-
|
62
|
-
|
63
|
-
This uses the chat completions endpoint, suitable for conversational queries
|
64
|
-
and leveraging Perplexity's online capabilities.
|
65
|
-
|
62
|
+
Initiates a chat completion request to generate AI responses using various models with customizable parameters.
|
63
|
+
|
66
64
|
Args:
|
67
|
-
query: The
|
68
|
-
model: The
|
69
|
-
temperature:
|
70
|
-
system_prompt:
|
71
|
-
|
65
|
+
query: The input text/prompt to send to the chat model
|
66
|
+
model: The model to use for chat completion. Options include 'r1-1776', 'sonar', 'sonar-pro', 'sonar-reasoning', 'sonar-reasoning-pro', 'sonar-deep-research'. Defaults to 'sonar'
|
67
|
+
temperature: Controls randomness in the model's output. Higher values make output more random, lower values more deterministic. Defaults to 1
|
68
|
+
system_prompt: Initial system message to guide the model's behavior. Defaults to 'Be precise and concise.'
|
69
|
+
|
72
70
|
Returns:
|
73
|
-
A dictionary containing 'content' (str) and 'citations' (list)
|
71
|
+
A dictionary containing the generated content and citations, with keys 'content' (str) and 'citations' (list), or a string in some cases
|
72
|
+
|
73
|
+
Raises:
|
74
|
+
AuthenticationError: Raised when API authentication fails due to missing or invalid credentials
|
75
|
+
HTTPError: Raised when the API request fails or returns an error status
|
76
|
+
|
77
|
+
Tags:
|
78
|
+
chat, generate, ai, completion, important
|
74
79
|
"""
|
75
80
|
endpoint = f"{self.base_url}/chat/completions"
|
76
|
-
|
77
81
|
messages = []
|
78
82
|
if system_prompt:
|
79
83
|
messages.append({"role": "system", "content": system_prompt})
|
80
84
|
messages.append({"role": "user", "content": query})
|
81
|
-
|
82
85
|
payload = {
|
83
86
|
"model": model,
|
84
87
|
"messages": messages,
|
85
88
|
"temperature": temperature,
|
86
89
|
# "max_tokens": 512,
|
87
90
|
}
|
88
|
-
|
89
91
|
data = self._post(endpoint, data=payload)
|
90
92
|
response = data.json()
|
91
93
|
content = response["choices"][0]["message"]["content"]
|