list-modules
Retrieve all modules within a specified organization using the Terrakube MCP Server for efficient infrastructure management and organization operations.
Instructions
Lists all modules in the specified organization
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | Organization ID |
Implementation Reference
- src/tools/modules.ts:16-36 (handler)Handler function that fetches the list of modules from the API for the given organization ID and returns the JSON response as text content.async ({ organizationId }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/module`, { headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" } }); if (!response.ok) { throw new Error(`Failed to list modules: ${response.statusText}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );
- src/tools/modules.ts:13-15 (schema)Input schema for the tool, requiring an organizationId string.{ organizationId: z.string().describe("Organization ID") },
- src/tools/modules.ts:10-36 (registration)Direct registration of the 'list-modules' tool on the MCP server, including schema and handler.server.tool( "list-modules", "Lists all modules in the specified organization", { organizationId: z.string().describe("Organization ID") }, async ({ organizationId }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/module`, { headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" } }); if (!response.ok) { throw new Error(`Failed to list modules: ${response.statusText}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );
- src/index.ts:24-24 (registration)Top-level call to registerModuleTools, which registers the 'list-modules' tool among others.registerModuleTools(server);