Add upload_cookies tool for manual session provision
All checks were successful
Build and Push Docker Image / build (push) Successful in 30s
All checks were successful
Build and Push Docker Image / build (push) Successful in 30s
This commit is contained in:
17
server.py
17
server.py
@@ -94,6 +94,23 @@ async def get_morningstar_data(ticker: str, debug: bool = False) -> str:
|
||||
result = await api.get_morningstar_data(ticker, debug=debug)
|
||||
return json.dumps(result)
|
||||
|
||||
@mcp.tool()
|
||||
async def upload_cookies(cookies_json: str) -> str:
|
||||
"""Upload session cookies to the server to assist with authentication.
|
||||
|
||||
Args:
|
||||
cookies_json: JSON string of cookies exported from a browser (Playwright format)
|
||||
"""
|
||||
try:
|
||||
# Validate JSON
|
||||
cookies = json.loads(cookies_json)
|
||||
# Write to cookies.json
|
||||
with open("cookies.json", "w") as f:
|
||||
json.dump(cookies, f)
|
||||
return json.dumps({"status": "success", "message": "cookies.json updated successfully"})
|
||||
except Exception as e:
|
||||
return json.dumps({"status": "error", "message": str(e)})
|
||||
|
||||
@mcp.tool()
|
||||
async def api_call(endpoint: str, method: str = "GET", params: str = "{}") -> str:
|
||||
"""Executes a raw API call to the Schwab service (Dummy implementation).
|
||||
|
||||
Reference in New Issue
Block a user