Skip to main content
Glama
terrakube-io

Terrakube MCP Server

by terrakube-io

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
NameRequiredDescriptionDefault
descriptionNoOrganization description
nameYesOrganization name

Implementation Reference

  • 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}`);
      }
    }
  • 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")
    },
  • 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);
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