list-organizations
Retrieve all organizations accessible to the current user within the Terrakube MCP Server, facilitating efficient workspace and infrastructure management.
Instructions
Lists all organizations accessible to the current user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/organizations.ts:14-33 (handler)The handler function for the 'list-organizations' tool. It makes a GET request to the /organization API endpoint using the configured API URL and PAT token, parses the JSON response, and returns it as a text content block.async () => { const response = await fetch(`${CONFIG.apiUrl}/organization`, { headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" } }); if (!response.ok) { throw new Error(`Failed to list organizations: ${response.statusText}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; }
- src/tools/organizations.ts:10-34 (registration)The registration of the 'list-organizations' tool on the MCP server within the registerOrganizationTools function. Includes empty input schema {} and inline handler.server.tool( "list-organizations", "Lists all organizations accessible to the current user", {}, async () => { const response = await fetch(`${CONFIG.apiUrl}/organization`, { headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" } }); if (!response.ok) { throw new Error(`Failed to list organizations: ${response.statusText}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );
- src/index.ts:22-22 (registration)Invocation of registerOrganizationTools on the MCP server instance, which registers the 'list-organizations' tool among others.registerOrganizationTools(server);