Skip to main content
Glama
terrakube-io

Terrakube MCP Server

by terrakube-io

get-module

Retrieve detailed information about a specific module by providing the module ID and organization ID within the Terrakube MCP Server infrastructure.

Instructions

Retrieves detailed information about a specific module

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
moduleIdYesModule ID
organizationIdYesOrganization ID

Implementation Reference

  • The handler function that implements the 'get-module' tool logic: fetches detailed information about a specific module from the Terrakube API using the provided organizationId and moduleId, parses the JSON response, and returns it formatted as text content.
    async ({ organizationId, moduleId }) => {
      const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/module/${moduleId}`, {
        headers: {
          Authorization: `Bearer ${CONFIG.patToken}`,
          "Content-Type": "application/vnd.api+json"
        }
      });
    
      if (!response.ok) {
        throw new Error(`Failed to get module: ${response.statusText}`);
      }
    
      const data = await response.json();
      return {
        content: [{
          type: "text",
          text: JSON.stringify(data, null, 2)
        }]
      };
    }
  • Zod input schema for the 'get-module' tool, defining required string parameters organizationId and moduleId with descriptions.
    {
      organizationId: z.string().describe("Organization ID"),
      moduleId: z.string().describe("Module ID")
    },
  • Direct registration of the 'get-module' tool on the MCP server using server.tool(), including name, description, schema, and handler.
    server.tool(
      "get-module",
      "Retrieves detailed information about a specific module",
      {
        organizationId: z.string().describe("Organization ID"),
        moduleId: z.string().describe("Module ID")
      },
      async ({ organizationId, moduleId }) => {
        const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/module/${moduleId}`, {
          headers: {
            Authorization: `Bearer ${CONFIG.patToken}`,
            "Content-Type": "application/vnd.api+json"
          }
        });
    
        if (!response.ok) {
          throw new Error(`Failed to get module: ${response.statusText}`);
        }
    
        const data = await response.json();
        return {
          content: [{
            type: "text",
            text: JSON.stringify(data, null, 2)
          }]
        };
      }
    );
  • src/index.ts:24-24 (registration)
    Higher-level registration call to registerModuleTools(server) in the main server setup, which includes the 'get-module' tool.
    registerModuleTools(server);
Install Server

Other Tools

Related 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/terrakube-io/mcp-server-terrakube'

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