get-organization
Retrieve detailed information about a specific organization by its ID using the MCP server to manage Terrakube infrastructure efficiently.
Instructions
Retrieves detailed information about a specific organization by its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Organization ID |
Implementation Reference
- src/tools/organizations.ts:42-61 (handler)The handler function for the 'get-organization' tool. It takes an organization ID, makes a GET request to the API endpoint `/organization/{id}`, handles errors, and returns the organization data as a formatted JSON string in the MCP response format.async ({ id }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${id}`, { headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" } }); if (!response.ok) { throw new Error(`Failed to get organization: ${response.statusText}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; }
- src/tools/organizations.ts:39-41 (schema)The input schema for the 'get-organization' tool, defining a required 'id' parameter as a string with description.{ id: z.string().describe("Organization ID") },
- src/tools/organizations.ts:36-62 (registration)The registration of the 'get-organization' tool on the MCP server using server.tool(), including name, description, input schema, and handler function. This is called within registerOrganizationTools which is invoked from src/index.ts.server.tool( "get-organization", "Retrieves detailed information about a specific organization by its ID", { id: z.string().describe("Organization ID") }, async ({ id }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${id}`, { headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" } }); if (!response.ok) { throw new Error(`Failed to get organization: ${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(server) in the main server setup, which registers the 'get-organization' tool among others.registerOrganizationTools(server);