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