universal-mcp-applications 0.1.21__py3-none-any.whl → 0.1.23__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 universal-mcp-applications might be problematic. Click here for more details.
- universal_mcp/applications/BEST_PRACTICES.md +166 -0
- universal_mcp/applications/airtable/app.py +0 -1
- universal_mcp/applications/apollo/app.py +0 -1
- universal_mcp/applications/aws_s3/app.py +40 -39
- universal_mcp/applications/browser_use/README.md +1 -0
- universal_mcp/applications/browser_use/__init__.py +0 -0
- universal_mcp/applications/browser_use/app.py +71 -0
- universal_mcp/applications/calendly/app.py +125 -125
- universal_mcp/applications/canva/app.py +95 -99
- universal_mcp/applications/confluence/app.py +0 -1
- universal_mcp/applications/contentful/app.py +4 -5
- universal_mcp/applications/domain_checker/app.py +11 -15
- universal_mcp/applications/e2b/app.py +4 -4
- universal_mcp/applications/elevenlabs/app.py +18 -15
- universal_mcp/applications/exa/app.py +17 -17
- universal_mcp/applications/falai/app.py +28 -29
- universal_mcp/applications/file_system/app.py +9 -9
- universal_mcp/applications/firecrawl/app.py +36 -36
- universal_mcp/applications/fireflies/app.py +55 -56
- universal_mcp/applications/fpl/app.py +49 -50
- universal_mcp/applications/ghost_content/app.py +0 -1
- universal_mcp/applications/github/app.py +41 -43
- universal_mcp/applications/google_calendar/app.py +40 -39
- universal_mcp/applications/google_docs/app.py +168 -232
- universal_mcp/applications/google_drive/app.py +212 -215
- universal_mcp/applications/google_gemini/app.py +1 -5
- universal_mcp/applications/google_mail/app.py +91 -90
- universal_mcp/applications/google_searchconsole/app.py +29 -29
- universal_mcp/applications/google_sheet/app.py +115 -115
- universal_mcp/applications/hashnode/README.md +6 -3
- universal_mcp/applications/hashnode/app.py +174 -25
- universal_mcp/applications/http_tools/app.py +10 -11
- universal_mcp/applications/hubspot/__init__.py +1 -1
- universal_mcp/applications/hubspot/api_segments/api_segment_base.py +36 -7
- universal_mcp/applications/hubspot/api_segments/crm_api.py +368 -368
- universal_mcp/applications/hubspot/api_segments/marketing_api.py +115 -115
- universal_mcp/applications/hubspot/app.py +131 -72
- universal_mcp/applications/jira/app.py +0 -1
- universal_mcp/applications/linkedin/app.py +20 -20
- universal_mcp/applications/markitdown/app.py +10 -5
- universal_mcp/applications/ms_teams/app.py +123 -123
- universal_mcp/applications/openai/app.py +40 -39
- universal_mcp/applications/outlook/app.py +32 -32
- universal_mcp/applications/perplexity/app.py +4 -4
- universal_mcp/applications/reddit/app.py +69 -70
- universal_mcp/applications/resend/app.py +116 -117
- universal_mcp/applications/rocketlane/app.py +0 -1
- universal_mcp/applications/scraper/__init__.py +1 -1
- universal_mcp/applications/scraper/app.py +80 -81
- universal_mcp/applications/serpapi/app.py +14 -14
- universal_mcp/applications/sharepoint/app.py +19 -20
- universal_mcp/applications/shopify/app.py +0 -1
- universal_mcp/applications/slack/app.py +48 -48
- universal_mcp/applications/tavily/app.py +4 -4
- universal_mcp/applications/twitter/api_segments/compliance_api.py +13 -15
- universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +20 -20
- universal_mcp/applications/twitter/api_segments/dm_events_api.py +12 -12
- universal_mcp/applications/twitter/api_segments/likes_api.py +12 -12
- universal_mcp/applications/twitter/api_segments/lists_api.py +37 -39
- universal_mcp/applications/twitter/api_segments/spaces_api.py +24 -24
- universal_mcp/applications/twitter/api_segments/trends_api.py +4 -4
- universal_mcp/applications/twitter/api_segments/tweets_api.py +105 -105
- universal_mcp/applications/twitter/api_segments/usage_api.py +4 -4
- universal_mcp/applications/twitter/api_segments/users_api.py +136 -136
- universal_mcp/applications/twitter/app.py +6 -2
- universal_mcp/applications/unipile/app.py +90 -97
- universal_mcp/applications/whatsapp/app.py +53 -54
- universal_mcp/applications/whatsapp/audio.py +39 -35
- universal_mcp/applications/whatsapp/whatsapp.py +176 -154
- universal_mcp/applications/whatsapp_business/app.py +92 -92
- universal_mcp/applications/yahoo_finance/app.py +105 -63
- universal_mcp/applications/youtube/app.py +193 -196
- universal_mcp/applications/zenquotes/__init__.py +2 -0
- universal_mcp/applications/zenquotes/app.py +5 -5
- {universal_mcp_applications-0.1.21.dist-info → universal_mcp_applications-0.1.23.dist-info}/METADATA +2 -1
- {universal_mcp_applications-0.1.21.dist-info → universal_mcp_applications-0.1.23.dist-info}/RECORD +78 -74
- {universal_mcp_applications-0.1.21.dist-info → universal_mcp_applications-0.1.23.dist-info}/WHEEL +0 -0
- {universal_mcp_applications-0.1.21.dist-info → universal_mcp_applications-0.1.23.dist-info}/licenses/LICENSE +0 -0
|
@@ -4,7 +4,6 @@ from typing import Any
|
|
|
4
4
|
|
|
5
5
|
import dns.resolver
|
|
6
6
|
import requests
|
|
7
|
-
|
|
8
7
|
from universal_mcp.applications.application import APIApplication
|
|
9
8
|
from universal_mcp.integrations import Integration
|
|
10
9
|
|
|
@@ -94,15 +93,15 @@ class DomainCheckerApp(APIApplication):
|
|
|
94
93
|
async def check_domain_registration(self, domain: str) -> dict[str, Any]:
|
|
95
94
|
"""
|
|
96
95
|
Determines a domain's availability by querying DNS and RDAP servers. For registered domains, it returns details like registrar and key dates. This function provides a comprehensive analysis for a single, fully qualified domain name, unlike `check_keyword_across_tlds_tool` which checks a keyword across multiple domains.
|
|
97
|
-
|
|
96
|
+
|
|
98
97
|
This method performs a comprehensive domain availability check by first checking DNS records
|
|
99
98
|
and then querying RDAP (Registration Data Access Protocol) servers for detailed registration
|
|
100
99
|
information. It provides detailed information about registered domains including registrar,
|
|
101
100
|
registration date, and expiration date.
|
|
102
|
-
|
|
101
|
+
|
|
103
102
|
Args:
|
|
104
103
|
domain: String representing the domain name to check (e.g., "example.com")
|
|
105
|
-
|
|
104
|
+
|
|
106
105
|
Returns:
|
|
107
106
|
Dictionary containing domain availability information with the following keys:
|
|
108
107
|
- domain: The domain name that was checked
|
|
@@ -113,12 +112,12 @@ class DomainCheckerApp(APIApplication):
|
|
|
113
112
|
- has_dns: Boolean indicating if DNS records exist
|
|
114
113
|
- rdap_data_available: Boolean indicating if RDAP data was retrieved
|
|
115
114
|
- note: Additional information when needed
|
|
116
|
-
|
|
115
|
+
|
|
117
116
|
Raises:
|
|
118
117
|
DNSException: When DNS resolution fails due to network issues or invalid domain format
|
|
119
118
|
RequestException: When RDAP queries fail due to network issues or server errors
|
|
120
119
|
ValueError: When the domain parameter is empty or contains invalid characters
|
|
121
|
-
|
|
120
|
+
|
|
122
121
|
Tags:
|
|
123
122
|
domain, availability, registration, dns, rdap, important
|
|
124
123
|
"""
|
|
@@ -206,15 +205,15 @@ class DomainCheckerApp(APIApplication):
|
|
|
206
205
|
async def find_available_domains_for_keyword(self, keyword: str) -> dict[str, Any]:
|
|
207
206
|
"""
|
|
208
207
|
Checks a keyword's availability across a predefined list of popular TLDs. Using DNS and RDAP lookups, it generates a summary report of available and taken domains. This bulk-check differs from `check_domain_registration`, which deeply analyzes a single, fully-qualified domain.
|
|
209
|
-
|
|
208
|
+
|
|
210
209
|
This method systematically checks a given keyword across 14 popular TLDs including .com, .net,
|
|
211
210
|
.org, .io, .co, .app, .dev, .ai, .me, .info, .xyz, .online, .site, and .tech. It performs
|
|
212
211
|
DNS lookups and RDAP queries to determine domain availability and provides a comprehensive
|
|
213
212
|
report of available and taken domains.
|
|
214
|
-
|
|
213
|
+
|
|
215
214
|
Args:
|
|
216
215
|
keyword: String representing the keyword to check across TLDs (e.g., "myapp")
|
|
217
|
-
|
|
216
|
+
|
|
218
217
|
Returns:
|
|
219
218
|
Dictionary containing TLD availability information with the following keys:
|
|
220
219
|
- keyword: The keyword that was checked
|
|
@@ -224,12 +223,12 @@ class DomainCheckerApp(APIApplication):
|
|
|
224
223
|
- available_domains: List of available domain names
|
|
225
224
|
- taken_domains: List of taken domain names
|
|
226
225
|
- tlds_checked_list: Complete list of TLDs that were checked
|
|
227
|
-
|
|
226
|
+
|
|
228
227
|
Raises:
|
|
229
228
|
DNSException: When DNS resolution fails due to network issues or invalid domain format
|
|
230
229
|
RequestException: When RDAP queries fail due to network issues or server errors
|
|
231
230
|
ValueError: When the keyword parameter is empty or contains invalid characters
|
|
232
|
-
|
|
231
|
+
|
|
233
232
|
Tags:
|
|
234
233
|
tld, keyword, domain-search, availability, bulk-check, important
|
|
235
234
|
"""
|
|
@@ -267,7 +266,4 @@ class DomainCheckerApp(APIApplication):
|
|
|
267
266
|
"""
|
|
268
267
|
Lists the available tools (methods) for this application.
|
|
269
268
|
"""
|
|
270
|
-
return [
|
|
271
|
-
self.check_domain_registration,
|
|
272
|
-
self.find_available_domains_for_keyword
|
|
273
|
-
]
|
|
269
|
+
return [self.check_domain_registration, self.find_available_domains_for_keyword]
|
|
@@ -131,19 +131,19 @@ class E2bApp(APIApplication):
|
|
|
131
131
|
) -> str:
|
|
132
132
|
"""
|
|
133
133
|
Executes a Python code string in a secure E2B sandbox. It authenticates using the configured API key, runs the code, and returns a formatted string containing the execution's output (stdout/stderr). It raises specific exceptions for authorization failures or general execution issues.
|
|
134
|
-
|
|
134
|
+
|
|
135
135
|
Args:
|
|
136
136
|
code: String containing the Python code to be executed in the sandbox.
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
Returns:
|
|
139
139
|
A string containing the formatted execution output/logs from running the code.
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
Raises:
|
|
142
142
|
ToolError: When there are issues with sandbox initialization or code execution,
|
|
143
143
|
or if the E2B SDK is not installed.
|
|
144
144
|
NotAuthorizedError: When API key authentication fails during sandbox setup.
|
|
145
145
|
ValueError: When provided code string is empty or invalid.
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
Tags:
|
|
148
148
|
execute, sandbox, code-execution, security, important
|
|
149
149
|
"""
|
|
@@ -2,13 +2,13 @@ import uuid
|
|
|
2
2
|
from io import BytesIO
|
|
3
3
|
|
|
4
4
|
import requests
|
|
5
|
-
|
|
6
|
-
from elevenlabs import ElevenLabs
|
|
7
5
|
from universal_mcp.applications.application import APIApplication
|
|
8
|
-
from universal_mcp.applications.file_system.app import FileSystemApp
|
|
9
6
|
from universal_mcp.exceptions import NotAuthorizedError
|
|
10
7
|
from universal_mcp.integrations import Integration
|
|
11
8
|
|
|
9
|
+
from elevenlabs import ElevenLabs
|
|
10
|
+
from universal_mcp.applications.file_system.app import FileSystemApp
|
|
11
|
+
|
|
12
12
|
|
|
13
13
|
class ElevenlabsApp(APIApplication):
|
|
14
14
|
def __init__(self, integration: Integration = None, **kwargs) -> None:
|
|
@@ -24,7 +24,11 @@ class ElevenlabsApp(APIApplication):
|
|
|
24
24
|
credentials = self.integration.get_credentials()
|
|
25
25
|
if not credentials:
|
|
26
26
|
raise NotAuthorizedError("No credentials found")
|
|
27
|
-
api_key =
|
|
27
|
+
api_key = (
|
|
28
|
+
credentials.get("api_key")
|
|
29
|
+
or credentials.get("API_KEY")
|
|
30
|
+
or credentials.get("apiKey")
|
|
31
|
+
)
|
|
28
32
|
if not api_key:
|
|
29
33
|
raise NotAuthorizedError("No api key found")
|
|
30
34
|
self._client = ElevenLabs(api_key=api_key)
|
|
@@ -41,17 +45,17 @@ class ElevenlabsApp(APIApplication):
|
|
|
41
45
|
) -> bytes:
|
|
42
46
|
"""
|
|
43
47
|
Converts a text string into speech using the ElevenLabs API. The function then saves the generated audio to a temporary MP3 file and returns a public URL to access it, rather than the raw audio bytes.
|
|
44
|
-
|
|
48
|
+
|
|
45
49
|
Args:
|
|
46
50
|
text (str): The text to convert to speech.
|
|
47
51
|
voice_id (str): The ID of the voice to use.
|
|
48
52
|
model_id (str, optional): The model to use. Defaults to "eleven_multilingual_v2".
|
|
49
53
|
stability (float, optional): The stability of the voice.
|
|
50
54
|
similarity_boost (float, optional): The similarity boost of the voice.
|
|
51
|
-
|
|
55
|
+
|
|
52
56
|
Returns:
|
|
53
57
|
bytes: The audio data.
|
|
54
|
-
|
|
58
|
+
|
|
55
59
|
Tags:
|
|
56
60
|
important
|
|
57
61
|
"""
|
|
@@ -77,13 +81,13 @@ class ElevenlabsApp(APIApplication):
|
|
|
77
81
|
) -> str:
|
|
78
82
|
"""
|
|
79
83
|
Transcribes an audio file into text using the ElevenLabs API. It supports language specification and speaker diarization, providing the inverse operation to the audio-generating `text_to_speech` method. Note: The docstring indicates this is a placeholder for an undocumented endpoint.
|
|
80
|
-
|
|
84
|
+
|
|
81
85
|
Args:
|
|
82
86
|
audio_file_path (str): The path to the audio file.
|
|
83
|
-
|
|
87
|
+
|
|
84
88
|
Returns:
|
|
85
89
|
str: The transcribed text.
|
|
86
|
-
|
|
90
|
+
|
|
87
91
|
Tags:
|
|
88
92
|
important
|
|
89
93
|
"""
|
|
@@ -104,15 +108,15 @@ class ElevenlabsApp(APIApplication):
|
|
|
104
108
|
) -> bytes:
|
|
105
109
|
"""
|
|
106
110
|
Downloads an audio file from a URL and converts the speech into a specified target voice using the ElevenLabs API. This function transforms the speaker's voice in an existing recording and returns the new audio data as bytes, distinct from creating audio from text.
|
|
107
|
-
|
|
111
|
+
|
|
108
112
|
Args:
|
|
109
113
|
voice_id (str): The ID of the voice to use for the conversion.
|
|
110
114
|
audio_file_path (str): The path to the audio file to transform.
|
|
111
115
|
model_id (str, optional): The model to use. Defaults to "eleven_multilingual_sts_v2".
|
|
112
|
-
|
|
116
|
+
|
|
113
117
|
Returns:
|
|
114
118
|
bytes: The transformed audio data.
|
|
115
|
-
|
|
119
|
+
|
|
116
120
|
Tags:
|
|
117
121
|
important
|
|
118
122
|
"""
|
|
@@ -139,8 +143,7 @@ async def demo_text_to_speech():
|
|
|
139
143
|
A demonstration function that instantiates the `ElevenlabsApp` to test its `text_to_speech` method. It converts a sample string to audio and prints the resulting file URL to the console, serving as a basic usage example when the script is executed directly.
|
|
140
144
|
"""
|
|
141
145
|
app = ElevenlabsApp()
|
|
142
|
-
|
|
143
|
-
print(audio)
|
|
146
|
+
await app.generate_speech_audio_url("Hello, world!")
|
|
144
147
|
|
|
145
148
|
|
|
146
149
|
if __name__ == "__main__":
|
|
@@ -28,7 +28,7 @@ class ExaApp(APIApplication):
|
|
|
28
28
|
) -> dict[str, Any]:
|
|
29
29
|
"""
|
|
30
30
|
Executes a query against the Exa API's `/search` endpoint, returning a list of results. This function supports extensive filtering by search type, category, domains, publication dates, and specific text content to refine the search query and tailor the API's response.
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
Args:
|
|
33
33
|
query (string): The query string for the search. Example: 'Latest developments in LLM capabilities'.
|
|
34
34
|
useAutoprompt (boolean): Autoprompt converts your query to an Exa-style query. Enabled by default for auto search, optional for neural search, and not available for keyword search. Example: 'True'.
|
|
@@ -44,10 +44,10 @@ class ExaApp(APIApplication):
|
|
|
44
44
|
includeText (array): List of strings that must be present in webpage text of results. Currently, only 1 string is supported, of up to 5 words. Example: "['large language model']".
|
|
45
45
|
excludeText (array): List of strings that must not be present in webpage text of results. Currently, only 1 string is supported, of up to 5 words. Example: "['course']".
|
|
46
46
|
contents (object): contents
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
Returns:
|
|
49
49
|
dict[str, Any]: OK
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
Tags:
|
|
52
52
|
important
|
|
53
53
|
"""
|
|
@@ -90,7 +90,7 @@ class ExaApp(APIApplication):
|
|
|
90
90
|
) -> dict[str, Any]:
|
|
91
91
|
"""
|
|
92
92
|
Finds web pages semantically similar to a given URL. Unlike the `search` function, which uses a text query, this method takes a specific link and returns a list of related results, with options to filter by domain, publication date, and content.
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
Args:
|
|
95
95
|
url (string): The url for which you would like to find similar links. Example: 'https://arxiv.org/abs/2307.06435'.
|
|
96
96
|
numResults (integer): Number of results to return (up to thousands of results available for custom plans) Example: '10'.
|
|
@@ -103,10 +103,10 @@ class ExaApp(APIApplication):
|
|
|
103
103
|
includeText (array): List of strings that must be present in webpage text of results. Currently, only 1 string is supported, of up to 5 words. Example: "['large language model']".
|
|
104
104
|
excludeText (array): List of strings that must not be present in webpage text of results. Currently, only 1 string is supported, of up to 5 words. Example: "['course']".
|
|
105
105
|
contents (object): contents
|
|
106
|
-
|
|
106
|
+
|
|
107
107
|
Returns:
|
|
108
108
|
dict[str, Any]: OK
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
Tags:
|
|
111
111
|
important
|
|
112
112
|
"""
|
|
@@ -145,7 +145,7 @@ class ExaApp(APIApplication):
|
|
|
145
145
|
) -> dict[str, Any]:
|
|
146
146
|
"""
|
|
147
147
|
Retrieves and processes content from a list of URLs, returning full text, summaries, or highlights. Unlike the search function which finds links, this function fetches the actual page content, with optional support for live crawling to get the most up-to-date information.
|
|
148
|
-
|
|
148
|
+
|
|
149
149
|
Args:
|
|
150
150
|
urls (array): Array of URLs to crawl (backwards compatible with 'ids' parameter). Example: "['https://arxiv.org/pdf/2307.06435']".
|
|
151
151
|
ids (array): Deprecated - use 'urls' instead. Array of document IDs obtained from searches. Example: "['https://arxiv.org/pdf/2307.06435']".
|
|
@@ -162,10 +162,10 @@ class ExaApp(APIApplication):
|
|
|
162
162
|
subpages (integer): The number of subpages to crawl. The actual number crawled may be limited by system constraints. Example: '1'.
|
|
163
163
|
subpageTarget (string): Keyword to find specific subpages of search results. Can be a single string or an array of strings, comma delimited. Example: 'sources'.
|
|
164
164
|
extras (object): Extra parameters to pass.
|
|
165
|
-
|
|
165
|
+
|
|
166
166
|
Returns:
|
|
167
167
|
dict[str, Any]: OK
|
|
168
|
-
|
|
168
|
+
|
|
169
169
|
Tags:
|
|
170
170
|
important
|
|
171
171
|
"""
|
|
@@ -191,16 +191,16 @@ class ExaApp(APIApplication):
|
|
|
191
191
|
def answer(self, query, stream=None, text=None, model=None) -> dict[str, Any]:
|
|
192
192
|
"""
|
|
193
193
|
Retrieves a direct, synthesized answer for a given query by calling the Exa `/answer` API endpoint. Unlike `search`, which returns web results, this function provides a conclusive response. It supports streaming, including source text, and selecting a search model.
|
|
194
|
-
|
|
194
|
+
|
|
195
195
|
Args:
|
|
196
196
|
query (string): The question or query to answer. Example: 'What is the latest valuation of SpaceX?'.
|
|
197
197
|
stream (boolean): If true, the response is returned as a server-sent events (SSS) stream.
|
|
198
198
|
text (boolean): If true, the response includes full text content in the search results
|
|
199
199
|
model (string): The search model to use for the answer. Exa passes only one query to exa, while exa-pro also passes 2 expanded queries to our search model.
|
|
200
|
-
|
|
200
|
+
|
|
201
201
|
Returns:
|
|
202
202
|
dict[str, Any]: OK
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
Tags:
|
|
205
205
|
important
|
|
206
206
|
"""
|
|
@@ -219,8 +219,8 @@ class ExaApp(APIApplication):
|
|
|
219
219
|
|
|
220
220
|
def list_tools(self):
|
|
221
221
|
return [
|
|
222
|
-
self.search_with_filters,
|
|
223
|
-
self.find_similar_by_url,
|
|
224
|
-
self.fetch_page_content,
|
|
225
|
-
self.answer
|
|
226
|
-
|
|
222
|
+
self.search_with_filters,
|
|
223
|
+
self.find_similar_by_url,
|
|
224
|
+
self.fetch_page_content,
|
|
225
|
+
self.answer,
|
|
226
|
+
]
|
|
@@ -3,7 +3,6 @@ from typing import Any, Literal
|
|
|
3
3
|
|
|
4
4
|
from fal_client import AsyncClient, AsyncRequestHandle, Status
|
|
5
5
|
from loguru import logger
|
|
6
|
-
|
|
7
6
|
from universal_mcp.applications.application import APIApplication
|
|
8
7
|
from universal_mcp.exceptions import NotAuthorizedError, ToolError
|
|
9
8
|
from universal_mcp.integrations import Integration
|
|
@@ -59,20 +58,20 @@ class FalaiApp(APIApplication):
|
|
|
59
58
|
) -> Any:
|
|
60
59
|
"""
|
|
61
60
|
Executes a Fal AI application synchronously, waiting for completion and returning the result directly. This method is suited for short-running tasks, unlike `submit` which queues a job for asynchronous processing and returns a request ID instead of the final output.
|
|
62
|
-
|
|
61
|
+
|
|
63
62
|
Args:
|
|
64
63
|
arguments: A dictionary of arguments for the application
|
|
65
64
|
application: The name or ID of the Fal application (defaults to 'fal-ai/flux/dev')
|
|
66
65
|
path: Optional subpath for the application endpoint
|
|
67
66
|
timeout: Optional timeout in seconds for the request
|
|
68
67
|
hint: Optional hint for runner selection
|
|
69
|
-
|
|
68
|
+
|
|
70
69
|
Returns:
|
|
71
70
|
The result of the application execution as a Python object (converted from JSON response)
|
|
72
|
-
|
|
71
|
+
|
|
73
72
|
Raises:
|
|
74
73
|
ToolError: Raised when the Fal API request fails, wrapping the original exception
|
|
75
|
-
|
|
74
|
+
|
|
76
75
|
Tags:
|
|
77
76
|
run, execute, ai, synchronous, fal, important
|
|
78
77
|
"""
|
|
@@ -102,7 +101,7 @@ class FalaiApp(APIApplication):
|
|
|
102
101
|
) -> str:
|
|
103
102
|
"""
|
|
104
103
|
Submits a job to the Fal AI queue for asynchronous processing, immediately returning a request ID. This contrasts with the `run` method, which waits for completion. The returned ID is used by `check_status`, `get_result`, and `cancel` to manage the job's lifecycle.
|
|
105
|
-
|
|
104
|
+
|
|
106
105
|
Args:
|
|
107
106
|
arguments: A dictionary of arguments for the application
|
|
108
107
|
application: The name or ID of the Fal application, defaulting to 'fal-ai/flux/dev'
|
|
@@ -110,13 +109,13 @@ class FalaiApp(APIApplication):
|
|
|
110
109
|
hint: Optional hint for runner selection
|
|
111
110
|
webhook_url: Optional URL to receive a webhook when the request completes
|
|
112
111
|
priority: Optional queue priority ('normal' or 'low')
|
|
113
|
-
|
|
112
|
+
|
|
114
113
|
Returns:
|
|
115
114
|
The request ID (str) of the submitted asynchronous job
|
|
116
|
-
|
|
115
|
+
|
|
117
116
|
Raises:
|
|
118
117
|
ToolError: Raised when the Fal API request fails, wrapping the original exception
|
|
119
|
-
|
|
118
|
+
|
|
120
119
|
Tags:
|
|
121
120
|
submit, async_job, start, ai, queue
|
|
122
121
|
"""
|
|
@@ -147,18 +146,18 @@ class FalaiApp(APIApplication):
|
|
|
147
146
|
) -> Status:
|
|
148
147
|
"""
|
|
149
148
|
Checks the execution state (e.g., Queued, InProgress) of an asynchronous Fal AI job using its request ID. It provides a non-blocking way to monitor jobs initiated via `submit` without fetching the final `result`, and can optionally include logs.
|
|
150
|
-
|
|
149
|
+
|
|
151
150
|
Args:
|
|
152
151
|
request_id: The unique identifier of the submitted request, obtained from a previous submit operation
|
|
153
152
|
application: The name or ID of the Fal application (defaults to 'fal-ai/flux/dev')
|
|
154
153
|
with_logs: Boolean flag to include execution logs in the status response (defaults to False)
|
|
155
|
-
|
|
154
|
+
|
|
156
155
|
Returns:
|
|
157
156
|
A Status object containing the current state of the request (Queued, InProgress, or Completed)
|
|
158
|
-
|
|
157
|
+
|
|
159
158
|
Raises:
|
|
160
159
|
ToolError: Raised when the Fal API request fails or when the provided request ID is invalid
|
|
161
|
-
|
|
160
|
+
|
|
162
161
|
Tags:
|
|
163
162
|
status, check, async_job, monitoring, ai
|
|
164
163
|
"""
|
|
@@ -182,17 +181,17 @@ class FalaiApp(APIApplication):
|
|
|
182
181
|
) -> Any:
|
|
183
182
|
"""
|
|
184
183
|
Retrieves the final result of an asynchronous job, identified by its `request_id`. This function waits for the job, initiated via `submit`, to complete. Unlike the non-blocking `check_status`, this method blocks execution to fetch and return the job's actual output upon completion.
|
|
185
|
-
|
|
184
|
+
|
|
186
185
|
Args:
|
|
187
186
|
request_id: The unique identifier of the submitted request
|
|
188
187
|
application: The name or ID of the Fal application (defaults to 'fal-ai/flux/dev')
|
|
189
|
-
|
|
188
|
+
|
|
190
189
|
Returns:
|
|
191
190
|
The result of the application execution, converted from JSON response to Python data structures (dict/list)
|
|
192
|
-
|
|
191
|
+
|
|
193
192
|
Raises:
|
|
194
193
|
ToolError: When the Fal API request fails or the request does not complete successfully
|
|
195
|
-
|
|
194
|
+
|
|
196
195
|
Tags:
|
|
197
196
|
result, async-job, status, wait, ai
|
|
198
197
|
"""
|
|
@@ -216,17 +215,17 @@ class FalaiApp(APIApplication):
|
|
|
216
215
|
) -> None:
|
|
217
216
|
"""
|
|
218
217
|
Asynchronously cancels a running or queued Fal AI job using its `request_id`. This function complements the `submit` method, providing a way to terminate asynchronous tasks before completion. It raises a `ToolError` if the cancellation request fails.
|
|
219
|
-
|
|
218
|
+
|
|
220
219
|
Args:
|
|
221
220
|
request_id: The unique identifier of the submitted Fal AI request to cancel
|
|
222
221
|
application: The name or ID of the Fal application (defaults to 'fal-ai/flux/dev')
|
|
223
|
-
|
|
222
|
+
|
|
224
223
|
Returns:
|
|
225
224
|
None. The function doesn't return any value.
|
|
226
|
-
|
|
225
|
+
|
|
227
226
|
Raises:
|
|
228
227
|
ToolError: Raised when the cancellation request fails due to API errors or if the request cannot be cancelled
|
|
229
|
-
|
|
228
|
+
|
|
230
229
|
Tags:
|
|
231
230
|
cancel, async_job, ai, fal, management
|
|
232
231
|
"""
|
|
@@ -245,16 +244,16 @@ class FalaiApp(APIApplication):
|
|
|
245
244
|
async def upload_file(self, path: str) -> str:
|
|
246
245
|
"""
|
|
247
246
|
Asynchronously uploads a local file to the Fal Content Delivery Network (CDN), returning a public URL. This URL makes the file accessible for use as input in other Fal AI job execution methods like `run` or `submit`. A `ToolError` is raised if the upload fails.
|
|
248
|
-
|
|
247
|
+
|
|
249
248
|
Args:
|
|
250
249
|
path: The absolute or relative path to the local file
|
|
251
|
-
|
|
250
|
+
|
|
252
251
|
Returns:
|
|
253
252
|
A string containing the public URL of the uploaded file on the CDN
|
|
254
|
-
|
|
253
|
+
|
|
255
254
|
Raises:
|
|
256
255
|
ToolError: If the file is not found or if the upload operation fails
|
|
257
|
-
|
|
256
|
+
|
|
258
257
|
Tags:
|
|
259
258
|
upload, file, cdn, storage, async, important
|
|
260
259
|
"""
|
|
@@ -281,7 +280,7 @@ class FalaiApp(APIApplication):
|
|
|
281
280
|
) -> Any:
|
|
282
281
|
"""
|
|
283
282
|
A specialized wrapper for the `run` method that synchronously generates images using the 'fal-ai/flux/dev' model. It simplifies image creation with common parameters like `prompt` and `seed`, waits for the task to complete, and directly returns the result containing image URLs and metadata.
|
|
284
|
-
|
|
283
|
+
|
|
285
284
|
Args:
|
|
286
285
|
prompt: The text prompt used to guide the image generation
|
|
287
286
|
seed: Random seed for reproducible image generation (default: 6252023)
|
|
@@ -291,13 +290,13 @@ class FalaiApp(APIApplication):
|
|
|
291
290
|
path: Subpath for the application endpoint (rarely used)
|
|
292
291
|
timeout: Maximum time in seconds to wait for the request to complete
|
|
293
292
|
hint: Hint string for runner selection
|
|
294
|
-
|
|
293
|
+
|
|
295
294
|
Returns:
|
|
296
295
|
A dictionary containing the generated image URLs and related metadata
|
|
297
|
-
|
|
296
|
+
|
|
298
297
|
Raises:
|
|
299
298
|
ToolError: When the image generation request fails or encounters an error
|
|
300
|
-
|
|
299
|
+
|
|
301
300
|
Tags:
|
|
302
301
|
generate, image, ai, async, important, flux, customizable, default
|
|
303
302
|
"""
|
|
@@ -17,18 +17,18 @@ class FileSystemApp(BaseApplication):
|
|
|
17
17
|
async def read_file(file_path: str):
|
|
18
18
|
"""
|
|
19
19
|
Asynchronously reads the entire content of a specified file in binary mode. This static method takes a file path and returns its data as a bytes object, serving as a fundamental file retrieval operation within the FileSystem application.
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
Args:
|
|
22
22
|
file_path (str): The path to the file to read.
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
Returns:
|
|
25
25
|
bytes: The file content as bytes.
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
Raises:
|
|
28
28
|
FileNotFoundError: If the file doesn't exist.
|
|
29
29
|
IOError: If there's an error reading the file.
|
|
30
|
-
|
|
31
|
-
Tags:
|
|
30
|
+
|
|
31
|
+
Tags:
|
|
32
32
|
important
|
|
33
33
|
"""
|
|
34
34
|
with open(file_path, "rb") as f:
|
|
@@ -38,12 +38,12 @@ class FileSystemApp(BaseApplication):
|
|
|
38
38
|
async def write_file(file_data: bytes, file_path: str = None):
|
|
39
39
|
"""
|
|
40
40
|
Writes binary data to a specified file path. If no path is provided, it creates a unique temporary file in `/tmp`. The function returns a dictionary confirming success and providing metadata about the new file, including its path and size.
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
Args:
|
|
43
43
|
file_data (bytes): The data to write to the file.
|
|
44
44
|
file_path (str, optional): The path where to write the file.
|
|
45
45
|
If None, generates a random path in /tmp. Defaults to None.
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
Returns:
|
|
48
48
|
dict: A dictionary containing the operation result with keys:
|
|
49
49
|
- status (str): "success" if the operation completed successfully
|
|
@@ -51,11 +51,11 @@ class FileSystemApp(BaseApplication):
|
|
|
51
51
|
- url (str): The file path where the data was written
|
|
52
52
|
- filename (str): The filename (same as url in this implementation)
|
|
53
53
|
- size (int): The size of the written data in bytes
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
Raises:
|
|
56
56
|
IOError: If there's an error writing the file.
|
|
57
57
|
PermissionError: If there are insufficient permissions to write to the path.
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
Tags:
|
|
60
60
|
important
|
|
61
61
|
"""
|