@@ -132,9 +132,9 @@ async def get_user_protocol_list() -> list[Protocol] | ErrorResponse:
132132 return protocols
133133
134134@mcp .tool ()
135- async def get_public_protocol_list_by_keyword (protocol_filter : Literal [ "public" , "user_public" , "user_private" , "shared_with_user" ], keyword : str , page_size : int = 10 , page_id : int = 1 ) -> list [Protocol ] | ErrorResponse :
136- """Get a list of public protocols on protocols.io by keyword."""
137- response = await helpers .access_protocols_io_resource ("GET" , f"/v3/protocols?filter={ protocol_filter } &key={ keyword } &page_size={ page_size } &page_id={ page_id } " )
135+ async def get_public_protocol_list_by_keyword (keyword : str , page_id : int = 1 ) -> list [Protocol ] | ErrorResponse :
136+ """Get a list of public protocols on protocols.io by keyword. Returns 3 protocols per page. Use page_id parameter for pagination (1-indexed). """
137+ response = await helpers .access_protocols_io_resource ("GET" , f"/v3/protocols?filter=public &key={ keyword } &page_size=3 &page_id={ page_id } " )
138138 if response ["status_code" ] != 0 :
139139 return ErrorResponse .from_api_response (response ["error_message" ])
140140 protocols = [await Protocol .from_api_response (protocol ) for protocol in response .get ("items" , [])]
@@ -179,7 +179,7 @@ async def update_protocol(
179179 return protocol
180180
181181@mcp .tool ()
182- async def create_or_update_protocol_step (protocol_id : int , steps : list [ProtocolStep ]) -> Protocol | ErrorResponse :
182+ async def create_or_update_protocol_step (protocol_id : int , steps : list [ProtocolStep ]) -> list [ ProtocolStep ] | ErrorResponse :
183183 """Create or update the steps of a protocol on protocols.io, if the step already exists (identified by its ID), it will be updated, otherwise it will be created."""
184184 steps_data = []
185185 for step in steps :
@@ -198,11 +198,11 @@ async def create_or_update_protocol_step(protocol_id: int, steps: list[ProtocolS
198198 response = await helpers .access_protocols_io_resource ("POST" , f"/v4/protocols/{ protocol_id } /steps" , data )
199199 if response ["status_code" ] != 0 :
200200 return ErrorResponse .from_api_response (response ["status_text" ])
201- protocol_response = await helpers .access_protocols_io_resource ("GET" , f"/v4/protocols/{ protocol_id } " )
202- if protocol_response ["status_code" ] != 0 :
203- return ErrorResponse .from_api_response (protocol_response ["status_text" ])
204- protocol = await Protocol .from_api_response (protocol_response [ "payload" ])
205- return protocol
201+ response_steps = await helpers .access_protocols_io_resource ("GET" , f"/v4/protocols/{ protocol_id } /steps " )
202+ if response_steps ["status_code" ] != 0 :
203+ return ErrorResponse .from_api_response (response_steps ["status_text" ])
204+ updated_steps = [ ProtocolStep .from_api_response (step ) for step in response_steps . get ( "payload" , [])]
205+ return updated_steps
206206
207207@mcp .tool ()
208208async def delete_protocol_step (protocol_id : int , step_ids : list [str ]) -> Protocol | ErrorResponse :
0 commit comments