Skip to content

Commit f473bc2

Browse files
author
Polygon
committed
Update docs
1 parent 90f112c commit f473bc2

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/mcp_polygon/server.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ async def handle_list_tools() -> list[types.Tool]:
135135
"enum": ["minute", "hour", "day", "week", "month", "quarter", "year"],
136136
"default": "day"
137137
},
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"},
140140
"limit": {"type": "integer", "description": "Limit of results returned", "default": 10},
141141
},
142-
"required": ["ticker", "from_date", "to_date"],
142+
"required": ["ticker", "from", "to"],
143143
},
144144
),
145145
types.Tool(
@@ -149,11 +149,14 @@ async def handle_list_tools() -> list[types.Tool]:
149149
"type": "object",
150150
"properties": {
151151
"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"},
155158
},
156-
"required": ["ticker", "date"],
159+
"required": ["ticker"],
157160
},
158161
)
159162
]
@@ -211,10 +214,10 @@ async def handle_get_aggs(arguments: dict) -> list[types.TextContent]:
211214
from_ = arguments.get("from")
212215
to = arguments.get("to")
213216
limit = arguments.get("limit", 10)
214-
217+
215218
if not ticker or not from_ or not to or not timespan or not multiplier:
216219
raise ValueError("Missing required parameters: ticker, from_, or to")
217-
220+
218221
try:
219222
# Call Polygon API
220223
results = polygon_client.get_aggs(
@@ -226,20 +229,17 @@ async def handle_get_aggs(arguments: dict) -> list[types.TextContent]:
226229
limit=limit
227230
)
228231

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"
230233
response_text += f"Found {len(results)} results\n\n"
231-
234+
232235
# Include the first few results in the text response
233236
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+
243243
else:
244244
response_text += "No results found."
245245

@@ -301,7 +301,7 @@ async def handle_list_trades(arguments: dict) -> list[types.TextContent]:
301301
for i, result in enumerate(results):
302302
if i >= limit:
303303
break
304-
response_text += f"Trade {i+1}:\n {result}\n"
304+
response_text += f"{result}\n"
305305

306306
else:
307307
response_text += "No trade data found."

0 commit comments

Comments
 (0)