Skip to main content
Glama

invite_user

Invite a new organization user, assign workspace roles, and create an API key if needed, all in one request.

Instructions

Invite a new org user and optionally provision workspace access and an API key in one call. Workspace assignments apply only after acceptance; use add_workspace_member or update_workspace_member later for follow-up changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesEmail address of the user to invite
roleYesOrganization-level role: 'admin' for full access, 'member' for limited access
first_nameNoUser's first name
last_nameNoUser's last name
workspacesYesList of workspaces and corresponding roles to grant to the user
workspace_api_key_detailsNoOptional API key to be created for the user

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesWhether the tool call succeeded and returned structured data
dataNoStructured success payload when ok is true
errorNoStructured error payload when ok is false

Implementation Reference

  • The tool 'invite_user' is registered with the MCP server via server.tool(...). Located in the registerUsersTools function (line 184) which is exported and called from elsewhere.
    // Invite user tool
    server.tool(
    	"invite_user",
    	"Invite a new org user and optionally provision workspace access and an API key in one call. Workspace assignments apply only after acceptance; use add_workspace_member or update_workspace_member later for follow-up changes.",
    	USERS_TOOL_SCHEMAS.inviteUser,
    	async (params) => {
    		const result = await service.users.inviteUser(params);
    		return {
    			content: [
    				{
    					type: "text",
    					text: JSON.stringify(
    						{
    							message: `Successfully invited ${params.email} as ${params.role}`,
    							invite_id: result.id,
    							invite_link: result.invite_link,
    						},
    						null,
    						2,
    					),
    				},
    			],
    		};
    	},
    );
  • Handler for 'invite_user': calls service.users.inviteUser(params) and returns a JSON response with message, invite_id, and invite_link.
    	async (params) => {
    		const result = await service.users.inviteUser(params);
    		return {
    			content: [
    				{
    					type: "text",
    					text: JSON.stringify(
    						{
    							message: `Successfully invited ${params.email} as ${params.role}`,
    							invite_id: result.id,
    							invite_link: result.invite_link,
    						},
    						null,
    						2,
    					),
    				},
    			],
    		};
    	},
    );
  • Zod schema for inviteUser parameters: email (required), role (admin|member), first_name, last_name, workspaces array, and workspace_api_key_details.
    inviteUser: {
    	email: z.string().email().describe("Email address of the user to invite"),
    	role: z
    		.enum(["admin", "member"])
    		.describe(
    			"Organization-level role: 'admin' for full access, 'member' for limited access",
    		),
    	first_name: z.string().optional().describe("User's first name"),
    	last_name: z.string().optional().describe("User's last name"),
    	workspaces: z
    		.array(
    			z.object({
    				id: z
    					.string()
    					.describe(
    						"Workspace ID/slug where the user will be granted access",
    					),
    				role: z
    					.enum(["admin", "member", "manager"])
    					.describe(
    						"Workspace-level role: 'admin' for full access, 'manager' for workspace management, 'member' for basic access",
    					),
    			}),
    		)
    		.describe(
    			"List of workspaces and corresponding roles to grant to the user",
    		),
    	workspace_api_key_details: z
    		.object({
    			name: z
    				.string()
    				.optional()
    				.describe("Name of the API key to be created"),
    			expiry: z
    				.string()
    				.optional()
    				.describe("Expiration date for the API key (ISO8601 format)"),
    			metadata: z
    				.record(z.string(), z.string())
    				.optional()
    				.describe("Additional metadata key-value pairs for the API key"),
    			scopes: z
    				.array(z.string())
    				.describe("List of permission scopes for the API key"),
    		})
    		.optional()
    		.describe("Optional API key to be created for the user"),
    },
  • InviteUserRequest TypeScript interface defining the request shape sent to the backend API.
    export interface InviteUserRequest {
    	email: string;
    	role: "admin" | "member";
    	first_name?: string;
    	last_name?: string;
    	workspaces: WorkspaceDetails[];
    	workspace_api_key_details?: WorkspaceApiKeyDetails;
    }
  • inviteUser method on UsersService that POSTs to /admin/users/invites and returns InviteUserResponse.
    async inviteUser(data: InviteUserRequest): Promise<InviteUserResponse> {
    	return this.post<InviteUserResponse>("/admin/users/invites", data);
    }
Behavior4/5

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

Annotations indicate non-read-only, non-destructive, non-idempotent, and open-world. The description adds behavioral context by noting that workspace assignments are effective only after acceptance, which is not captured in annotations. This is valuable transparency beyond the structured fields.

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 extremely concise: two sentences that cover purpose, optional features, and important behavioral nuance. Every word adds value, with no redundancy.

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?

Given the tool's complexity (6 parameters, nested objects, output schema exists), the description covers the main purpose, optional capabilities, and key behavioral point about delayed workspace assignment. It is sufficiently complete for an AI agent to understand the tool's role, though it could briefly mention that an invitation is sent.

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?

Schema coverage is 100%, so the schema already describes all parameters. The description mentions optional provisioning of workspace access and API key, which aligns with the 'workspaces' and 'workspace_api_key_details' parameters but adds little extra meaning. Baseline score of 3 is appropriate.

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 tool invites a new org user and optionally provisions workspace access and an API key. It distinguishes from sibling tools like add_workspace_member by noting that workspace assignments apply only after acceptance, prompting use of separate tools for follow-ups.

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

Usage Guidelines5/5

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

The description explicitly states the tool's use case (inviting a new org user) and clarifies when to use alternative tools for workspace changes after acceptance. This provides clear guidance on when and when not to use this tool.

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/s-b-e-n-s-o-n/portkey-admin-mcp'

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