Skip to main content
Glama

cortex_create_organization

Create a new organization in Cortex. Requires superadmin API key. Input name and description.

Instructions

Create a new organization in Cortex (requires superadmin API key)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesOrganization name (used as ID, no spaces recommended)
descriptionYesOrganization description

Implementation Reference

  • The MCP tool handler for 'cortex_create_organization'. Validates that the superadmin key is available, then calls client.createOrganization with name and description from the Zod schema, and returns a formatted JSON response with the new organization details.
    server.tool(
      "cortex_create_organization",
      "Create a new organization in Cortex (requires superadmin API key)",
      {
        name: z
          .string()
          .describe("Organization name (used as ID, no spaces recommended)"),
        description: z.string().describe("Organization description"),
      },
      async ({ name, description }) => {
        try {
          if (!client.superadminAvailable) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: "Organization management requires CORTEX_SUPERADMIN_KEY environment variable to be set.",
                },
              ],
              isError: true,
            };
          }
    
          const org = await client.createOrganization({ name, description });
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(
                  {
                    id: org.id,
                    name: org.name,
                    description: org.description,
                    status: org.status,
                    message: `Organization "${org.name}" created successfully.`,
                  },
                  null,
                  2,
                ),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error creating organization: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
            isError: true,
          };
        }
      },
    );
  • The Zod input schema for the cortex_create_organization tool, requiring 'name' (string) and 'description' (string).
    {
      name: z
        .string()
        .describe("Organization name (used as ID, no spaces recommended)"),
      description: z.string().describe("Organization description"),
    },
  • The registerOrganizationTools function registers all organization tools on the MCP server, including cortex_create_organization via server.tool().
    export function registerOrganizationTools(
      server: McpServer,
      client: CortexClient,
    ): void {
      server.tool(
        "cortex_list_organizations",
        "List all organizations (requires superadmin API key via CORTEX_SUPERADMIN_KEY)",
        {},
        async () => {
          try {
            if (!client.superadminAvailable) {
              return {
                content: [
                  {
                    type: "text" as const,
                    text: "Organization management requires CORTEX_SUPERADMIN_KEY environment variable to be set.",
                  },
                ],
                isError: true,
              };
            }
    
            const orgs = await client.listOrganizations();
            const summary = orgs.map((o) => ({
              id: o.id,
              name: o.name,
              description: o.description,
              status: o.status,
              createdAt: o.createdAt
                ? new Date(o.createdAt).toISOString()
                : undefined,
            }));
    
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify(summary, null, 2),
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error listing organizations: ${error instanceof Error ? error.message : String(error)}`,
                },
              ],
              isError: true,
            };
          }
        },
      );
    
      server.tool(
        "cortex_get_organization",
        "Get details about a specific organization (requires superadmin API key)",
        {
          orgId: z.string().describe("The organization ID or name"),
        },
        async ({ orgId }) => {
          try {
            if (!client.superadminAvailable) {
              return {
                content: [
                  {
                    type: "text" as const,
                    text: "Organization management requires CORTEX_SUPERADMIN_KEY environment variable to be set.",
                  },
                ],
                isError: true,
              };
            }
    
            const org = await client.getOrganization(orgId);
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify(org, null, 2),
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error getting organization: ${error instanceof Error ? error.message : String(error)}`,
                },
              ],
              isError: true,
            };
          }
        },
      );
    
      server.tool(
        "cortex_create_organization",
        "Create a new organization in Cortex (requires superadmin API key)",
        {
          name: z
            .string()
            .describe("Organization name (used as ID, no spaces recommended)"),
          description: z.string().describe("Organization description"),
        },
        async ({ name, description }) => {
          try {
            if (!client.superadminAvailable) {
              return {
                content: [
                  {
                    type: "text" as const,
                    text: "Organization management requires CORTEX_SUPERADMIN_KEY environment variable to be set.",
                  },
                ],
                isError: true,
              };
            }
    
            const org = await client.createOrganization({ name, description });
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify(
                    {
                      id: org.id,
                      name: org.name,
                      description: org.description,
                      status: org.status,
                      message: `Organization "${org.name}" created successfully.`,
                    },
                    null,
                    2,
                  ),
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error creating organization: ${error instanceof Error ? error.message : String(error)}`,
                },
              ],
              isError: true,
            };
          }
        },
      );
    
      server.tool(
        "cortex_update_organization",
        "Update an organization's description or status (requires superadmin API key)",
        {
          orgId: z.string().describe("The organization ID or name"),
          description: z
            .string()
            .optional()
            .describe("New description for the organization"),
          status: z
            .enum(["Active", "Locked"])
            .optional()
            .describe('New status: "Active" or "Locked"'),
        },
        async ({ orgId, description, status }) => {
          try {
            if (!client.superadminAvailable) {
              return {
                content: [
                  {
                    type: "text" as const,
                    text: "Organization management requires CORTEX_SUPERADMIN_KEY environment variable to be set.",
                  },
                ],
                isError: true,
              };
            }
    
            const updates: Record<string, string> = {};
            if (description !== undefined) updates.description = description;
            if (status !== undefined) updates.status = status;
    
            if (Object.keys(updates).length === 0) {
              return {
                content: [
                  {
                    type: "text" as const,
                    text: "No updates provided. Specify at least description or status.",
                  },
                ],
                isError: true,
              };
            }
    
            const org = await client.updateOrganization(orgId, updates);
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify(
                    {
                      id: org.id,
                      name: org.name,
                      description: org.description,
                      status: org.status,
                      message: `Organization "${org.name}" updated successfully.`,
                    },
                    null,
                    2,
                  ),
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error updating organization: ${error instanceof Error ? error.message : String(error)}`,
                },
              ],
              isError: true,
            };
          }
        },
      );
    }
  • src/index.ts:12-44 (registration)
    The main entry point imports and calls registerOrganizationTools to wire up the organization tools (including cortex_create_organization) on the MCP server.
    import { registerOrganizationTools } from "./tools/organizations.js";
    import { registerUserTools } from "./tools/users.js";
    import { registerResources } from "./resources.js";
    import { registerPrompts } from "./prompts.js";
    
    async function main(): Promise<void> {
      const config = getConfig();
    
      if (!config.verifySsl) {
        process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
      }
    
      const server = new McpServer({
        name: "cortex-mcp",
        version: "1.2.0",
        description:
          "MCP server for Cortex - observable analysis and active response engine by StrangeBee/TheHive Project",
      });
    
      const client = new CortexClient(config);
    
      // Core analysis tools
      registerAnalyzerTools(server, client);
      registerJobTools(server, client);
      registerResponderTools(server, client);
      registerBulkTools(server, client);
    
      // Administration tools
      registerAnalyzerDefinitionTools(server, client);
      registerResponderDefinitionTools(server, client);
      registerStatusTools(server, client);
      registerOrganizationTools(server, client);
      registerUserTools(server, client);
  • The CortexClient.createOrganization method that makes the actual HTTP POST request to the /organization API endpoint with superadmin auth (useSuperadmin=true). It sends name, description, and defaults status to 'Active'.
    async createOrganization(data: {
      name: string;
      description: string;
      status?: string;
    }): Promise<Organization> {
      return this.request<Organization>(
        "/organization",
        {
          method: "POST",
          body: JSON.stringify({
            name: data.name,
            description: data.description,
            status: data.status ?? "Active",
          }),
        },
        true,
      );
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of behavioral disclosure. It correctly notes the need for a superadmin API key, which is a critical auth requirement. It does not mention idempotency or uniqueness constraints, but the 'create' verb implies a new resource is always created.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is front-loaded with the action and resource. Every word is necessary, with no extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple creation tool with two required parameters and no output schema, the description covers the key points: action, resource, and auth requirement. It could optionally mention the return value (e.g., the created organization object) but this is not essential.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage with descriptions for both parameters ('name' and 'description'). The description does not add additional meaning beyond the schema, so it meets the baseline for high coverage without exceeding it.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('organization'), and distinguishes from sibling tools like cortex_update_organization and cortex_list_organizations. The requirement for a superadmin API key adds specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides context by noting the superadmin API key requirement, which guides when to use the tool. However, it does not explicitly mention when not to use it or contrast with alternatives like cortex_update_organization, though the verb 'create' implies it's for initial creation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/solomonneas/cortex-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server