@@ -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:
442443async 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