Skip to main content
Glama

get_nodit_api_spec

Retrieve resolved API specification details for blockchain operations to understand available data structures and parameters.

Instructions

Gets the fully resolved spec details for a Nodit Blockchain Context API operationId. Returns details as a JSON string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationIdYesThe operationId to get the resolved specification for.

Implementation Reference

  • Handler logic that identifies the API type based on operationId, retrieves spec details using helper functions, formats the response, and returns JSON string or error.
    async ({ operationId }) => { const toolName = "get_nodit_api_spec"; log(`Tool (${toolName}): Request for operationId: ${operationId}`); let apiInfo; if (isNodeApi(operationId)) { apiInfo = findNoditNodeApiDetails(operationId, noditNodeApiSpecMap); } else if (isWebhookApi(operationId)) { const postfix = "\nThis API cannot be invoked using the call_nodit_api tool." apiInfo = findNoditWebhookApiDetails(operationId, noditWebhookApiSpec); if (apiInfo && !apiInfo.details.description?.endsWith(postfix)) { apiInfo.details.description = apiInfo.details.description + postfix; } } else { apiInfo = findNoditDataApiDetails(operationId, noditDataApiSpec); } if (!apiInfo) { return createErrorResponse(`Spec for operationId '${operationId}' not found.`, toolName); } const finalSpecDetails = { operationId: operationId, path: apiInfo.path, method: apiInfo.method, details: apiInfo.details, }; return { content: [{ type: "text", text: JSON.stringify(finalSpecDetails, null, 2) }] }; }
  • Zod input schema defining the operationId parameter.
    { operationId: z.string().describe("The operationId to get the resolved specification for.") },
  • Function that registers the tool by loading API specs and calling server.tool with name, description, schema, and handler.
    export function registerGetNoditApiSpecTool(server: McpServer) { const noditNodeApiSpecMap: Map<string, NoditOpenApiSpecType> = loadNoditNodeApiSpecMap(); const noditDataApiSpec: NoditOpenApiSpecType = loadNoditDataApiSpec(); const noditWebhookApiSpec: NoditOpenApiSpecType = loadNoditWebhookApiSpec(); server.tool( "get_nodit_api_spec", "Gets the fully resolved spec details for a Nodit Blockchain Context API operationId. Returns details as a JSON string.", { operationId: z.string().describe("The operationId to get the resolved specification for.") }, async ({ operationId }) => { const toolName = "get_nodit_api_spec"; log(`Tool (${toolName}): Request for operationId: ${operationId}`); let apiInfo; if (isNodeApi(operationId)) { apiInfo = findNoditNodeApiDetails(operationId, noditNodeApiSpecMap); } else if (isWebhookApi(operationId)) { const postfix = "\nThis API cannot be invoked using the call_nodit_api tool." apiInfo = findNoditWebhookApiDetails(operationId, noditWebhookApiSpec); if (apiInfo && !apiInfo.details.description?.endsWith(postfix)) { apiInfo.details.description = apiInfo.details.description + postfix; } } else { apiInfo = findNoditDataApiDetails(operationId, noditDataApiSpec); } if (!apiInfo) { return createErrorResponse(`Spec for operationId '${operationId}' not found.`, toolName); } const finalSpecDetails = { operationId: operationId, path: apiInfo.path, method: apiInfo.method, details: apiInfo.details, }; return { content: [{ type: "text", text: JSON.stringify(finalSpecDetails, null, 2) }] }; } ); }
  • Top-level call to register the get_nodit_api_spec tool during all tools registration.
    registerGetNoditApiSpecTool(server);
  • Helper function to load Nodit node API specs into a map, used in the tool registration and handler.
    export function loadNoditNodeApiSpecMap(): Map<string, NoditOpenApiSpecType> { const noditApiSpecMap = new Map<string, NoditOpenApiSpecType>(); const specDir = path.resolve(__dirname, '../spec/reference'); try { const files = fs.readdirSync(specDir);

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