test_quantconnect_api
Verify QuantConnect API connectivity and authentication status to ensure trading platform integration functions correctly.
Instructions
Test QuantConnect API connectivity with current authentication.
Args: endpoint: API endpoint to test (default: authenticate) method: HTTP method to use (default: POST)
Returns: Dictionary containing API test results
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "test_quantconnect_api"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint | No | authenticate | |
| method | No | POST |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for the 'test_quantconnect_api' tool. Decorated with @mcp.tool() for automatic schema generation from type hints and docstring, and registration with the MCP server. Tests QuantConnect API connectivity by making an authenticated HTTP request to the specified endpoint.
@mcp.tool() async def test_quantconnect_api( endpoint: str = "authenticate", method: str = "POST" ) -> Dict[str, Any]: """ Test QuantConnect API connectivity with current authentication. Args: endpoint: API endpoint to test (default: authenticate) method: HTTP method to use (default: POST) Returns: Dictionary containing API test results """ try: auth = get_auth_instance() if auth is None: return { "status": "error", "error": "Authentication not configured", "message": "Configure authentication first using configure_quantconnect_auth", } # Make API request response = await auth.make_authenticated_request(endpoint, method) # Parse response try: response_data = response.json() except: response_data = {"raw_content": response.text} return { "status": "success", "endpoint": endpoint, "method": method, "status_code": response.status_code, "response_data": response_data, "headers": dict(response.headers), "success": response.status_code == 200, } except Exception as e: return { "status": "error", "error": str(e), "message": f"Failed to test API endpoint: {endpoint}", }