create-organization
Generate a new organization with a specified name and optional description using the Terrakube MCP Server. Simplifies infrastructure management by enabling organized setup and configuration.
Instructions
Creates a new organization with the specified name and optional description
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | Organization description | |
| name | Yes | Organization name |
Implementation Reference
- src/tools/organizations.ts:71-102 (handler)The async handler function that executes the tool logic: constructs JSON payload with organization data and sends POST request to API endpoint.async ({ name, description = "" }) => { const body = JSON.stringify({ data: { type: "organization", attributes: { name, description } } }); const response = await fetch(`${CONFIG.apiUrl}/organization`, { method: "POST", headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" }, body: body }); if (response.status === 201) { const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } else { throw new Error(`Failed to create organization: ${response.statusText}`); } }
- src/tools/organizations.ts:67-70 (schema)Zod input schema defining required 'name' and optional 'description' parameters for the tool.{ name: z.string().describe("Organization name"), description: z.string().optional().describe("Organization description") },
- src/tools/organizations.ts:64-103 (registration)MCP server.tool() call that registers the 'create-organization' tool with its description, schema, and handler.server.tool( "create-organization", "Creates a new organization with the specified name and optional description", { name: z.string().describe("Organization name"), description: z.string().optional().describe("Organization description") }, async ({ name, description = "" }) => { const body = JSON.stringify({ data: { type: "organization", attributes: { name, description } } }); const response = await fetch(`${CONFIG.apiUrl}/organization`, { method: "POST", headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" }, body: body }); if (response.status === 201) { const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } else { throw new Error(`Failed to create organization: ${response.statusText}`); } } );
- src/index.ts:22-22 (registration)Invocation of registerOrganizationTools in the main server setup, which includes registration of the create-organization tool.registerOrganizationTools(server);