time
Retrieve current server time to synchronize cryptocurrency trading operations with Aster Finance Futures API, ensuring accurate timestamping for market data and order execution.
Instructions
Get the current server time.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:585-586 (handler)Handler for the 'time' tool: dispatches a GET request to the Aster API endpoint '/fapi/v1/time' using the shared makeRequest function.case 'time': return makeRequest('GET', '/fapi/v1/time', {});
- src/index.ts:53-53 (registration)Registration of the 'time' tool in the ListTools response, including name, description, and empty input schema.{ name: 'time', description: 'Get the current server time.', inputSchema: { type: 'object', properties: {} } },
- src/index.ts:542-579 (helper)Shared utility function 'makeRequest' that handles HTTP requests to the Aster API, including optional signing with API key/secret.const makeRequest = async (method: 'GET' | 'POST' | 'DELETE', path: string, params: any, isSigned = false) => { try { let config: any = { method, url: path, }; if (isSigned) { if (!API_KEY || !API_SECRET) { throw new McpError(ErrorCode.InvalidRequest, 'API_KEY and API_SECRET must be configured.'); } params.timestamp = Date.now(); const queryString = new URLSearchParams(params).toString(); const signature = crypto.createHmac('sha256', API_SECRET).update(queryString).digest('hex'); params.signature = signature; config.headers = { 'X-MBX-APIKEY': API_KEY }; } if (method === 'GET' || method === 'DELETE') { config.params = params; } else { // POST config.data = new URLSearchParams(params).toString(); config.headers = { ...config.headers, 'Content-Type': 'application/x-www-form-urlencoded' }; } const response = await this.axiosInstance.request(config); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] }; } catch (error) { if (axios.isAxiosError(error)) { throw new McpError( ErrorCode.InternalError, `Aster API error: ${error.response?.data?.msg || error.message}` ); } throw error; } };