Skip to main content
Glama

get_nodit_aptos_indexer_api_spec

Retrieve GraphQL specifications for querying Aptos blockchain data through the Nodit Indexer API to understand available data structures and parameters.

Instructions

Returns the GraphQL specification for a specific query root in the Nodit Aptos Indexer API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryRootYesThe name of the query root to get the specification for. Use list_nodit_aptos_indexer_api_query_root to see available query roots.

Implementation Reference

  • Executes the tool logic: loads API spec, finds table by queryRoot, builds GraphQLSpec with columns and relationships, returns JSON.
    async ({ queryRoot }) => {
      const toolName = "get_nodit_aptos_indexer_api_spec";
    
      try {
        if (!noditAptosIndexerApiSpec || !noditAptosIndexerApiSpec.metadata || !noditAptosIndexerApiSpec.metadata.sources) {
          return createErrorResponse("Failed to load or parse the Aptos Indexer API schema", toolName);
        }
    
        type TableType = NonNullable<NonNullable<NonNullable<AptosIndexerApiSpec['metadata']>['sources']>[0]['tables']>[0];
        let tableSpec: TableType | null = null;
        for (const source of noditAptosIndexerApiSpec.metadata.sources) {
          if (source.tables) {
            for (const tableInfo of source.tables) {
              if (tableInfo.configuration && tableInfo.configuration.custom_name === queryRoot) {
                tableSpec = tableInfo;
                break;
              }
            }
          }
          if (tableSpec) break;
        }
    
        if (!tableSpec) {
          return createErrorResponse(`Query root '${queryRoot}' not found in the Aptos Indexer API schema. Use list_nodit_aptos_indexer_api_query_root to see available query roots.`, toolName);
        }
    
        const spec: GraphQLSpec = {
          name: queryRoot,
          table: tableSpec.table,
          columns: tableSpec.select_permissions?.[0]?.permission?.columns || [],
          relationships: {
            object: [],
            array: []
          }
        };
    
        if (tableSpec.object_relationships) {
          spec.relationships.object = tableSpec.object_relationships.map((rel: Relationship) => {
            if (!rel || typeof rel !== 'object') return { name: 'unknown', remote_table: 'unknown', column_mapping: {} };
            return {
              name: rel.name ?? 'unknown',
              remote_table: rel.using?.manual_configuration?.remote_table?.name ?? 'unknown',
              column_mapping: rel.using?.manual_configuration?.column_mapping ?? {}
            };
          });
        }
    
        if (tableSpec.array_relationships) {
          spec.relationships.array = tableSpec.array_relationships.map((rel: Relationship) => {
            if (!rel || typeof rel !== 'object') return { name: 'unknown', remote_table: 'unknown', column_mapping: {} };
            return {
              name: rel.name ?? 'unknown',
              remote_table: rel.using?.manual_configuration?.remote_table?.name ?? 'unknown',
              column_mapping: rel.using?.manual_configuration?.column_mapping ?? {}
            };
          });
        }
    
        return {
          content: [{
            type: "text",
            text: `GraphQL specification for query root '${queryRoot}':\n\n${JSON.stringify(spec, null, 2)}`
          }]
        };
      } catch (error) {
        return createErrorResponse(`Error processing Aptos Indexer API schema: ${(error as Error).message}`, toolName);
      }
    }
  • Zod input schema defining the queryRoot parameter.
        queryRoot: z.string().describe("The name of the query root to get the specification for. Use list_nodit_aptos_indexer_api_query_root to see available query roots."),
    },
  • Registers the tool with MCP server, including name, description, input schema, and handler reference.
    server.tool(
      "get_nodit_aptos_indexer_api_spec",
      "Returns the GraphQL specification for a specific query root in the Nodit Aptos Indexer API.",
      {
          queryRoot: z.string().describe("The name of the query root to get the specification for. Use list_nodit_aptos_indexer_api_query_root to see available query roots."),
      },
      async ({ queryRoot }) => {
        const toolName = "get_nodit_aptos_indexer_api_spec";
    
        try {
          if (!noditAptosIndexerApiSpec || !noditAptosIndexerApiSpec.metadata || !noditAptosIndexerApiSpec.metadata.sources) {
            return createErrorResponse("Failed to load or parse the Aptos Indexer API schema", toolName);
          }
    
          type TableType = NonNullable<NonNullable<NonNullable<AptosIndexerApiSpec['metadata']>['sources']>[0]['tables']>[0];
          let tableSpec: TableType | null = null;
          for (const source of noditAptosIndexerApiSpec.metadata.sources) {
            if (source.tables) {
              for (const tableInfo of source.tables) {
                if (tableInfo.configuration && tableInfo.configuration.custom_name === queryRoot) {
                  tableSpec = tableInfo;
                  break;
                }
              }
            }
            if (tableSpec) break;
          }
    
          if (!tableSpec) {
            return createErrorResponse(`Query root '${queryRoot}' not found in the Aptos Indexer API schema. Use list_nodit_aptos_indexer_api_query_root to see available query roots.`, toolName);
          }
    
          const spec: GraphQLSpec = {
            name: queryRoot,
            table: tableSpec.table,
            columns: tableSpec.select_permissions?.[0]?.permission?.columns || [],
            relationships: {
              object: [],
              array: []
            }
          };
    
          if (tableSpec.object_relationships) {
            spec.relationships.object = tableSpec.object_relationships.map((rel: Relationship) => {
              if (!rel || typeof rel !== 'object') return { name: 'unknown', remote_table: 'unknown', column_mapping: {} };
              return {
                name: rel.name ?? 'unknown',
                remote_table: rel.using?.manual_configuration?.remote_table?.name ?? 'unknown',
                column_mapping: rel.using?.manual_configuration?.column_mapping ?? {}
              };
            });
          }
    
          if (tableSpec.array_relationships) {
            spec.relationships.array = tableSpec.array_relationships.map((rel: Relationship) => {
              if (!rel || typeof rel !== 'object') return { name: 'unknown', remote_table: 'unknown', column_mapping: {} };
              return {
                name: rel.name ?? 'unknown',
                remote_table: rel.using?.manual_configuration?.remote_table?.name ?? 'unknown',
                column_mapping: rel.using?.manual_configuration?.column_mapping ?? {}
              };
            });
          }
    
          return {
            content: [{
              type: "text",
              text: `GraphQL specification for query root '${queryRoot}':\n\n${JSON.stringify(spec, null, 2)}`
            }]
          };
        } catch (error) {
          return createErrorResponse(`Error processing Aptos Indexer API schema: ${(error as Error).message}`, toolName);
        }
      }
    );
  • TypeScript interface defining the structure of the Aptos Indexer API spec loaded and used by the tool.
    export interface AptosIndexerApiSpec {
      metadata?: {
        sources?: Array<{
          tables?: Array<{
            table?: string;
            configuration?: {
              custom_name?: string;
            };
            select_permissions?: Array<{
              permission?: {
                columns?: string[];
              };
            }>;
            object_relationships?: Array<Relationship>;
            array_relationships?: Array<Relationship>;
          }>;
        }>;
      };
    }
  • Helper function that loads the JSON schema file for the Nodit Aptos Indexer API, used to populate the spec data.
    export function loadNoditAptosIndexerApiSpec(): AptosIndexerApiSpec {
      const schemaPath = path.resolve(__dirname, '../nodit-aptos-indexer-api-schema.json');
      return loadOpenapiSpecFile(schemaPath) as AptosIndexerApiSpec;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool returns a GraphQL specification, which implies a read-only operation, but doesn't clarify aspects like authentication requirements, rate limits, error handling, or the format of the returned specification. This leaves significant behavioral gaps for an agent to rely on.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is somewhat complete but lacks depth. It covers the basic purpose but doesn't address behavioral aspects like return format or error cases, which are important for an agent to use the tool effectively without annotations or output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'queryRoot' well-documented in the schema itself. The description adds minimal value beyond the schema by reiterating 'for a specific query root' but doesn't provide additional syntax, examples, or constraints. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Returns') and resource ('GraphQL specification for a specific query root in the Nodit Aptos Indexer API'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_nodit_api_spec', which might return a different API specification, leaving some ambiguity in sibling context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying 'for a specific query root' and references 'list_nodit_aptos_indexer_api_query_root' in the schema, suggesting when to use it (after listing query roots). However, it lacks explicit guidance on when to choose this tool over alternatives like 'get_nodit_api_spec' or when not to use it, leaving usage context partially implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/noditlabs/nodit-mcp-server'

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