Skip to main content
Glama

update_user

Update user's first name, last name, or organization-level role by user ID. Workspace membership changes are handled separately.

Instructions

Update a user's first name, last name, or organization role by id. Email and workspace roles are not editable here; use update_workspace_member for workspace membership changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYesThe user ID to update
first_nameNoNew first name
last_nameNoNew last name
roleNoNew organization-level role

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

  • Core handler for update_user. Sends a PUT request to /admin/users/{userId} with the UpdateUserRequest data and returns the updated PortkeyUser.
    async updateUser(
    	userId: string,
    	data: UpdateUserRequest,
    ): Promise<PortkeyUser> {
    	return this.put<PortkeyUser>(
    		`/admin/users/${this.encodePathSegment(userId)}`,
    		data,
    	);
    }
  • Input schema for the update_user request, defining optional fields: first_name, last_name, and role.
    export interface UpdateUserRequest {
    	first_name?: string;
    	last_name?: string;
    	role?: "admin" | "member";
    }
  • Zod validation schema for the update_user tool, defining user_id (required), first_name, last_name, and role (all optional except user_id).
    updateUser: {
    	user_id: z.string().describe("The user ID to update"),
    	first_name: z.string().optional().describe("New first name"),
    	last_name: z.string().optional().describe("New last name"),
    	role: z
    		.enum(["admin", "member"])
    		.optional()
    		.describe("New organization-level role"),
    },
  • Registration of the 'update_user' MCP tool on the server, binding the Zod schema and handler that calls service.users.updateUser().
    server.tool(
    	"update_user",
    	"Update a user's first name, last name, or organization role by id. Email and workspace roles are not editable here; use update_workspace_member for workspace membership changes.",
    	USERS_TOOL_SCHEMAS.updateUser,
    	async (params) => {
    		const { user_id, ...updateData } = params;
    		const user = await service.users.updateUser(user_id, updateData);
    		return {
    			content: [
    				{
    					type: "text",
    					text: JSON.stringify(
    						{
    							message: "Successfully updated user",
    							user: formatUser(user),
    						},
    						null,
    						2,
    					),
    				},
    			],
    		};
    	},
    );
  • Helper used by updateUser to safely encode the user_id path segment in the URL.
    protected encodePathSegment(value: string): string {
    	return encodeURIComponent(value);
    }
Behavior4/5

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

Annotations indicate it's a mutation (readOnlyHint: false). The description confirms it modifies user fields and adds the important constraint that email and workspace roles are off-limits. It does not describe side effects, error conditions, or permissions, but given annotations already signal mutability, the description adds sufficient behavioral context for a simple update.

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?

Delivers maximum information in two sentences: first sentence states the action and scope, second sentence specifies exclusions and suggests an alternative. No wasted words; front-loaded with essential details.

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 tool with an output schema, the description covers what is updatable, what is not, and directs to an alternative. It lacks mention of prerequisites (e.g., user existence, authentication) or error behavior. However, given the tool's low complexity and the presence of openWorldHint, it is fairly complete.

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

Parameters4/5

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

Schema coverage is 100% with descriptions for each parameter. The overall description adds value by clarifying which parameters are and aren't editable, providing context beyond individual parameter descriptions. This compensates for the baseline 3.

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?

Clearly states verb 'Update', resource 'user', and lists specific fields (first name, last name, organization role). Explicitly distinguishes from update_workspace_member by stating what is not editable. This leaves no ambiguity about the tool's purpose.

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?

Provides explicit when-to-use and when-not-to-use guidance: 'Email and workspace roles are not editable here; use update_workspace_member for workspace membership changes.' Directly contrasts with a sibling tool, helping an agent select the correct 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