@@ -135,11 +135,11 @@ async def handle_list_tools() -> list[types.Tool]:
135
135
"enum" : ["minute" , "hour" , "day" , "week" , "month" , "quarter" , "year" ],
136
136
"default" : "day"
137
137
},
138
- "from_date " : {"type" : "string" , "description" : "From date in YYYY-MM-DD format" },
139
- "to_date " : {"type" : "string" , "description" : "To date in YYYY-MM-DD format" },
138
+ "from " : {"type" : "string" , "description" : "From date in YYYY-MM-DD format" },
139
+ "to " : {"type" : "string" , "description" : "To date in YYYY-MM-DD format" },
140
140
"limit" : {"type" : "integer" , "description" : "Limit of results returned" , "default" : 10 },
141
141
},
142
- "required" : ["ticker" , "from_date " , "to_date " ],
142
+ "required" : ["ticker" , "from " , "to " ],
143
143
},
144
144
),
145
145
types .Tool (
@@ -149,11 +149,14 @@ async def handle_list_tools() -> list[types.Tool]:
149
149
"type" : "object" ,
150
150
"properties" : {
151
151
"ticker" : {"type" : "string" , "description" : "Stock ticker symbol (e.g., AAPL)" },
152
- "date" : {"type" : "string" , "description" : "Date for the trades in YYYY-MM-DD format" },
153
- "timestamp" : {"type" : "integer" , "description" : "Timestamp in Unix milliseconds format" , "default" : 0 },
154
- "limit" : {"type" : "integer" , "description" : "Limit of results returned" , "default" : 10 },
152
+ "limit" : {"type" : "integer" , "description" : "Limit of results returned" , "default" : 100 },
153
+ "timestamp.gte" : {"type" : "string" , "description" : "Greater than or equal to timestamp" },
154
+ "timestamp.gt" : {"type" : "string" , "description" : "Greater than timestamp" },
155
+ "timestamp.lte" : {"type" : "string" , "description" : "Less than or equal to timestamp" },
156
+ "timestamp.lt" : {"type" : "string" , "description" : "Less than timestamp" },
157
+ "sort" : {"type" : "string" , "description" : "Sort order" , "enum" : ["asc" , "desc" ], "default" : "asc" },
155
158
},
156
- "required" : ["ticker" , "date" ],
159
+ "required" : ["ticker" ],
157
160
},
158
161
)
159
162
]
@@ -211,10 +214,10 @@ async def handle_get_aggs(arguments: dict) -> list[types.TextContent]:
211
214
from_ = arguments .get ("from" )
212
215
to = arguments .get ("to" )
213
216
limit = arguments .get ("limit" , 10 )
214
-
217
+
215
218
if not ticker or not from_ or not to or not timespan or not multiplier :
216
219
raise ValueError ("Missing required parameters: ticker, from_, or to" )
217
-
220
+
218
221
try :
219
222
# Call Polygon API
220
223
results = polygon_client .get_aggs (
@@ -226,20 +229,17 @@ async def handle_get_aggs(arguments: dict) -> list[types.TextContent]:
226
229
limit = limit
227
230
)
228
231
229
- response_text = f"Aggregated data for { ticker } from { from_ } to { to } :\n \n "
232
+ response_text = f"Agg data for { ticker } from { from_ } to { to } :\n \n "
230
233
response_text += f"Found { len (results )} results\n \n "
231
-
234
+
232
235
# Include the first few results in the text response
233
236
if results :
234
- for i , result in enumerate (results [:5 ]):
235
- response_text += f"Entry { i + 1 } :\n "
236
- for key , value in result .items ():
237
- if value is not None :
238
- response_text += f" { key } : { value } \n "
239
- response_text += "\n "
240
-
241
- if len (results ) > 5 :
242
- response_text += f"...and { len (results ) - 5 } more entries."
237
+ for i , result in enumerate (results ):
238
+ if i >= limit :
239
+ break
240
+
241
+ response_text += f"{ result } \n "
242
+
243
243
else :
244
244
response_text += "No results found."
245
245
@@ -301,7 +301,7 @@ async def handle_list_trades(arguments: dict) -> list[types.TextContent]:
301
301
for i , result in enumerate (results ):
302
302
if i >= limit :
303
303
break
304
- response_text += f"Trade { i + 1 } : \n { result } \n "
304
+ response_text += f"{ result } \n "
305
305
306
306
else :
307
307
response_text += "No trade data found."
0 commit comments