cortex_get_organization
Retrieve details for a specific organization using a superadmin API key.
Instructions
Get details about a specific organization (requires superadmin API key)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| orgId | Yes | The organization ID or name |
Implementation Reference
- src/tools/organizations.ts:60-101 (handler)The MCP tool handler for 'cortex_get_organization'. It registers the tool with the MCP server using server.tool(), accepts an 'orgId' string parameter, checks superadmin availability, calls client.getOrganization(orgId), and returns the organization details as JSON.
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, }; } }, ); - src/tools/organizations.ts:60-101 (schema)The input schema for 'cortex_get_organization' defined via Zod: orgId is a required string with description 'The organization ID or name'.
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, }; } }, ); - src/client.ts:351-357 (helper)The CortexClient.getOrganization() method that makes the actual HTTP GET request to '/organization/{orgId}' using superadmin auth and returns the Organization.
async getOrganization(orgId: string): Promise<Organization> { return this.request<Organization>( `/organization/${encodeURIComponent(orgId)}`, {}, true, ); } - src/types.ts:178-188 (helper)The Organization interface returned by getOrganization, defining all fields (id, name, description, status, createdAt, createdBy, etc.).
export interface Organization { id: string; name: string; description: string; status: string; createdAt?: number; createdBy?: string; updatedAt?: number; updatedBy?: string; _type?: string; } - src/index.ts:43-43 (registration)Registration call: registerOrganizationTools(server, client) which registers all organization tools including 'cortex_get_organization'.
registerOrganizationTools(server, client);