get_status
Check the current status of an AWS Athena query execution to monitor progress and determine when results are ready.
Instructions
Get the current status of a query execution
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| queryExecutionId | Yes | The query execution ID |
Implementation Reference
- src/index.ts:204-224 (handler)MCP tool handler for 'get_status': validates the queryExecutionId argument and delegates to AthenaService.getQueryStatus, returning the JSON-formatted status.case "get_status": { if (!request.params.arguments?.queryExecutionId || typeof request.params.arguments.queryExecutionId !== 'string') { throw new McpError( ErrorCode.InvalidParams, "Missing or invalid required parameter: queryExecutionId (string)" ); } const status = await this.athenaService.getQueryStatus( request.params.arguments.queryExecutionId ); return { content: [ { type: "text", text: JSON.stringify(status, null, 2), }, ], }; }
- src/index.ts:93-106 (schema)Input schema definition for the 'get_status' tool, specifying the required queryExecutionId parameter.{ name: "get_status", description: "Get the current status of a query execution", inputSchema: { type: "object", properties: { queryExecutionId: { type: "string", description: "The query execution ID", }, }, required: ["queryExecutionId"], }, },
- src/athena.ts:92-125 (helper)Core implementation of query status retrieval using AWS AthenaClient.GetQueryExecutionCommand, extracting state, reasons, statistics, and handling errors.async getQueryStatus(queryExecutionId: string): Promise<QueryStatus> { try { const response = await this.client.send( new GetQueryExecutionCommand({ QueryExecutionId: queryExecutionId, }) ); if (!response.QueryExecution) { throw { message: "Query execution not found", code: "QUERY_NOT_FOUND", }; } return { state: response.QueryExecution.Status?.State || "UNKNOWN", stateChangeReason: response.QueryExecution.Status?.StateChangeReason, statistics: { dataScannedInBytes: response.QueryExecution.Statistics?.DataScannedInBytes || 0, engineExecutionTimeInMillis: response.QueryExecution.Statistics?.EngineExecutionTimeInMillis || 0, }, substatementType: response.QueryExecution.SubstatementType, }; } catch (error) { if (error instanceof InvalidRequestException) { throw { message: "Query execution not found", code: "QUERY_NOT_FOUND", }; } throw error; } }