Skip to content

Commit 323073c

Browse files
committed
Fix dos
1 parent dd77693 commit 323073c

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

uns_mcp/connectors/destination/weaviate.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ async def create_weaviate_destination(
4242
Args:
4343
cluster_url: URL of the weaviate cluster
4444
collection : Name of the collection to use in the weaviate cluster
45-
Note: The collection is a table in the weaviate cluster.
46-
In platform, there are dedicated code to generate collection for users
47-
here, due to the simplicity of the server, we are not generating it for users.
45+
46+
Note: The collection is a table in the Weaviate cluster. In the platform, the collection
47+
name can be generated automatically; however, this is not yet supported via the API.
48+
Therefore, the collection name is required. Please note that the schema cannot be empty
49+
and must contain at least a record_id: Text.
4850
4951
Returns:
5052
String containing the created destination connector information

uns_mcp/server.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ async def app_lifespan(server: FastMCP) -> AsyncIterator[AppContext]:
104104

105105

106106
@mcp.tool()
107-
async def list_sources(ctx: Context, source_type: Optional[str] = None) -> str:
107+
async def list_sources(ctx: Context, source_type: Optional[SourceConnectorType] = None) -> str:
108108
"""
109109
List available sources from the Unstructured API.
110110
@@ -118,9 +118,8 @@ async def list_sources(ctx: Context, source_type: Optional[str] = None) -> str:
118118

119119
request = ListSourcesRequest()
120120
if source_type:
121-
source_type = source_type.upper() # it needs uppercase to access
122121
try:
123-
request.source_type = SourceConnectorType[source_type]
122+
request.source_type = SourceConnectorType(source_type)
124123
except KeyError:
125124
return f"Invalid source type: {source_type}"
126125

@@ -166,7 +165,10 @@ async def get_source_info(ctx: Context, source_id: str) -> str:
166165

167166

168167
@mcp.tool()
169-
async def list_destinations(ctx: Context, destination_type: Optional[str] = None) -> str:
168+
async def list_destinations(
169+
ctx: Context,
170+
destination_type: Optional[DestinationConnectorType] = None,
171+
) -> str:
170172
"""List available destinations from the Unstructured API.
171173
172174
Args:
@@ -179,9 +181,8 @@ async def list_destinations(ctx: Context, destination_type: Optional[str] = None
179181

180182
request = ListDestinationsRequest()
181183
if destination_type:
182-
destination_type = destination_type.upper()
183184
try:
184-
request.destination_type = DestinationConnectorType[destination_type]
185+
request.destination_type = DestinationConnectorType(destination_type)
185186
except KeyError:
186187
return f"Invalid destination type: {destination_type}"
187188

@@ -234,7 +235,7 @@ async def list_workflows(
234235
ctx: Context,
235236
destination_id: Optional[str] = None,
236237
source_id: Optional[str] = None,
237-
status: Optional[str] = None,
238+
status: Optional[WorkflowState] = None,
238239
) -> str:
239240
"""
240241
List workflows from the Unstructured API.
@@ -253,7 +254,7 @@ async def list_workflows(
253254

254255
if status:
255256
try:
256-
request.status = WorkflowState[status]
257+
request.status = WorkflowState(status)
257258
except KeyError:
258259
return f"Invalid workflow status: {status}"
259260

@@ -442,7 +443,7 @@ async def delete_workflow(ctx: Context, workflow_id: str) -> str:
442443
async def list_jobs(
443444
ctx: Context,
444445
workflow_id: Optional[str] = None,
445-
status: Optional[str] = None,
446+
status: Optional[JobStatus] = None,
446447
) -> str:
447448
"""
448449
List jobs via the Unstructured API.
@@ -460,7 +461,7 @@ async def list_jobs(
460461

461462
if status:
462463
try:
463-
request.status = JobStatus[status]
464+
request.status = JobStatus(status)
464465
except KeyError:
465466
return f"Invalid job status: {status}"
466467

0 commit comments

Comments
 (0)