Skip to main content
Glama

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
NameRequiredDescriptionDefault
queryExecutionIdYesThe query execution ID

Implementation Reference

  • 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),
          },
        ],
      };
    }
  • 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"],
      },
    },
  • 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;
      }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lishenxydlgzs/aws-athena-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server