Skip to main content
Glama

lokalise_add_projects_to_group

Add projects to a user group, granting all members immediate access. Use to expand group scope or onboard projects to teams.

Instructions

Adds projects to a user group, granting all group members access to specified projects. Required: teamId, groupId, projectIds array. Use to expand group project scope, onboard projects to existing teams, or batch project assignments. Returns: Operation confirmation. All group members gain immediate project access.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
teamIdYesTeam ID containing the user group
groupIdYesUser group ID
projectIdsYesProject IDs to add to the group

Implementation Reference

  • Registration of the 'lokalise_add_projects_to_group' MCP tool with schema and handler.
    server.tool(
    	"lokalise_add_projects_to_group",
    	"Adds projects to a user group, granting all group members access to specified projects. Required: teamId, groupId, projectIds array. Use to expand group project scope, onboard projects to existing teams, or batch project assignments. Returns: Operation confirmation. All group members gain immediate project access.",
    	AddProjectsToolArgs.shape,
    	handleAddProjects,
    );
  • Handler function that delegates to controller's addProjects method and formats the response.
    async function handleAddProjects(args: AddProjectsToolArgsType) {
    	const methodLogger = Logger.forContext(
    		"usergroups.tool.ts",
    		"handleAddProjects",
    	);
    	methodLogger.debug("Adding projects to user group...", args);
    
    	try {
    		const result = await usergroupsController.addProjects(args);
    		methodLogger.debug("Got the response from the controller", result);
    
    		return {
    			content: [
    				{
    					type: "text" as const,
    					text: result.content,
    				},
    			],
    		};
    	} catch (error) {
    		methodLogger.error("Tool failed", {
    			error: (error as Error).message,
    			args,
    		});
    		return formatErrorForMcpTool(error);
  • Zod schema defining input validation for teamId (string), groupId (string|number), and projectIds (array of string|number, min 1).
    export const AddProjectsToolArgs = z
    	.object({
    		teamId: z.string().describe("Team ID containing the user group"),
    		groupId: z.union([z.string(), z.number()]).describe("User group ID"),
    		projectIds: z
    			.array(z.union([z.string(), z.number()]))
    			.min(1)
    			.describe("Project IDs to add to the group"),
    	})
    	.strict();
    
    export type AddProjectsToolArgsType = z.infer<typeof AddProjectsToolArgs>;
  • Service layer that calls the Lokalise API SDK's add_projects_to_group method.
    async addProjects(args: AddProjectsToolArgsType): Promise<UserGroup> {
    	const methodLogger = logger.forMethod("addProjects");
    	methodLogger.info("Adding projects to user group", {
    		teamId: args.teamId,
    		groupId: args.groupId,
    		projectCount: args.projectIds.length,
    	});
    
    	try {
    		const api = getLokaliseApi();
    		// Convert project IDs to proper array type for SDK
    		const projectIds = args.projectIds.map((id) =>
    			typeof id === "string" ? id : id.toString(),
    		);
    		const result = await api
    			.userGroups()
    			.add_projects_to_group(args.teamId, args.groupId, projectIds);
    
    		methodLogger.info("Added projects to user group successfully", {
    			teamId: args.teamId,
    			groupId: args.groupId,
    			addedCount: args.projectIds.length,
    		});
    
    		return result;
    	} catch (error) {
    		methodLogger.error("Failed to add projects to user group", {
    			error,
    			args,
    		});
    		throw createUnexpectedError(
    			`Failed to add projects to user group ${args.groupId}`,
    			error,
    		);
    	}
    },
  • Helper that formats the API response into a Markdown string for the user.
    export function formatAddProjectsResult(
    	group: UserGroup,
    	addedCount: number,
    ): string {
    	let content = "# Projects Added Successfully\n\n";
    	content += `**Group**: ${group.name} (ID: ${group.group_id})\n`;
    	content += `**Projects Added**: ${addedCount}\n`;
    	content += `**Total Projects**: ${group.projects?.length || 0}\n\n`;
    
    	content += `✅ Successfully added ${addedCount} project(s) to the user group\n`;
    
    	return content;
    }
Behavior3/5

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

No annotations are provided, so the description must carry the full burden. It states that all group members gain immediate project access (mutation) but does not detail permissions, reversibility, or side effects. Some behavioral context is given, but not comprehensive.

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?

Three sentences cover action, required params, use cases, and return value. No redundant or unnecessary information. Efficient and well-structured.

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 mutation tool with 3 parameters, no output schema, and no nested objects, the description adequately covers basic usage, effect, and return value. Lacks error handling or rate limit info, but is reasonably complete for its complexity.

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 description coverage is 100%, so the schema already documents each parameter. The description adds minimal extra meaning (e.g., reiterating required params) but does not significantly enhance understanding beyond what the schema provides.

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 ('Adds projects to a user group') and the effect ('granting all group members access to specified projects'). It differentiates from siblings like 'lokalise_add_members_to_group' and 'lokalise_remove_projects_from_group' by specifying the resource (projects) and the group.

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?

Provides explicit use cases: 'expand group project scope, onboard projects to existing teams, or batch project assignments.' No when-not-to-use or alternatives, but the context is clear given the sibling tools.

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/AbdallahAHO/lokalise-mcp'

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