@@ -83,9 +83,10 @@ def list_endpoints_by_tag(tags: List[str]) -> str:
8383 "total_endpoints" : len (index ._index )
8484 }, indent = 2 )
8585
86+ # Serialize Pydantic models to dictionaries
8687 return json .dumps ({
8788 "count" : len (endpoints ),
88- "endpoints" : endpoints
89+ "endpoints" : [ ep . model_dump () for ep in endpoints ]
8990 }, indent = 2 )
9091
9192 except Exception as e :
@@ -132,7 +133,8 @@ def get_endpoint_schema(endpoint_id: str) -> str:
132133 "suggestion" : "Use list_endpoints_by_tag() to find available endpoints"
133134 }, indent = 2 )
134135
135- return json .dumps (schema , indent = 2 )
136+ # Serialize Pydantic model to dictionary
137+ return json .dumps (schema .model_dump (by_alias = True ), indent = 2 )
136138
137139 except Exception as e :
138140 logger .error (f"Error getting endpoint schema: { e } " )
@@ -188,7 +190,7 @@ def call_obp_api(
188190 }, indent = 2 )
189191
190192 # Construct the path with parameters
191- path = endpoint [ " path" ]
193+ path = endpoint . path
192194 if path_params :
193195 for key , value in path_params .items ():
194196 path = path .replace (f"{{{ key } }}" , str (value ))
@@ -200,7 +202,7 @@ def call_obp_api(
200202 url = f"{ base_url } { path } "
201203
202204 # Prepare request
203- method = endpoint [ " method" ]. upper ()
205+ method = endpoint . method . value # HttpMethod enum value
204206 request_headers = headers or {}
205207
206208 # Make the request
0 commit comments