Skip to main content
Glama

lokalise_create_comments

Add comments to translation keys to ask questions, provide context, or flag issues for team collaboration. Supports bulk creation for efficiency.

Instructions

Adds one or more comments to a translation key for team collaboration. Required: projectId, keyId, comments array with 'comment' text. Use to ask translators questions, provide context, leave implementation notes, or flag issues. Supports bulk creation for efficiency. Returns: Created comments with IDs. Note: Comments are visible to all project members.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID to create comments in
keyIdYesKey ID to attach comments to
commentsYesArray of comments to create

Implementation Reference

  • Registration of the 'lokalise_create_comments' tool with the MCP server, associating the tool name, description, Zod schema, and handler function.
    server.tool(
    	"lokalise_create_comments",
    	"Adds one or more comments to a translation key for team collaboration. Required: projectId, keyId, comments array with 'comment' text. Use to ask translators questions, provide context, leave implementation notes, or flag issues. Supports bulk creation for efficiency. Returns: Created comments with IDs. Note: Comments are visible to all project members.",
    	CreateCommentsToolArgs.shape,
    	handleCreateComments,
    );
  • MCP tool handler that receives validated arguments, delegates to the controller, and returns a formatted text response or error.
    async function handleCreateComments(args: CreateCommentsToolArgsType) {
    	const methodLogger = Logger.forContext(
    		"comments.tool.ts",
    		"handleCreateComments",
    	);
    	methodLogger.debug(`Creating ${args.comments.length} comment(s)...`, args);
    
    	try {
    		const result = await commentsController.createComments(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 the input parameters for creating comments: projectId (string), keyId (number), and comments (array of objects with 'comment' string).
    export const CreateCommentsToolArgs = z
    	.object({
    		projectId: z.string().describe("Project ID to create comments in"),
    		keyId: z.number().describe("Key ID to attach comments to"),
    		comments: z
    			.array(CommentDataSchema)
    			.min(1)
    			.describe("Array of comments to create"),
    	})
    	.strict();
    
    export type CreateCommentsToolArgsType = z.infer<typeof CreateCommentsToolArgs>;
  • Service layer that calls the Lokalise API's comments().create() with mapped data and project/key IDs.
    async createComments(args: CreateCommentsToolArgsType): Promise<Comment[]> {
    	const methodLogger = logger.forMethod("createComments");
    	methodLogger.info("Creating comments", {
    		projectId: args.projectId,
    		keyId: args.keyId,
    		count: args.comments.length,
    	});
    
    	try {
    		const api = getLokaliseApi();
    
    		// Map our schema to SDK types
    		const commentData: CommentData[] = args.comments.map((item) => ({
    			comment: item.comment,
    		}));
    
    		const result = await api.comments().create(commentData, {
    			project_id: args.projectId,
    			key_id: args.keyId,
    		});
    
    		methodLogger.info("Created comments successfully", {
    			projectId: args.projectId,
    			keyId: args.keyId,
    			created: result.length,
    		});
    
    		return result;
    	} catch (error) {
    		methodLogger.error("Failed to create comments", { error, args });
    		throw createUnexpectedError(
    			`Failed to create comments on key ${args.keyId} in project ${args.projectId}`,
    			error,
    		);
    	}
    },
Behavior3/5

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

Discloses that comments are visible to all project members and that the tool returns created comments with IDs. No annotations exist, so description carries the burden, but it does not cover permissions, rate limits, or error handling for a creation operation.

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

Conciseness4/5

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

Four sentences front-load purpose, then required fields, use cases, and return/note. No redundant information, though the required fields sentence somewhat duplicates schema.

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

Completeness3/5

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

Covers required fields, return format, visibility, and bulk capability. However, lacks details on error conditions, required permissions, and what happens if the key does not exist. For a creation tool with no output schema, more completeness would be beneficial.

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?

All parameters have schema descriptions (100% coverage), so description adds limited value beyond repetition. It highlights bulk creation (array can have multiple items) and return format, but does not provide deeper semantic context like constraints on comment text length or formats.

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 adds comments to a translation key for team collaboration, specifying it can handle one or more comments and supports bulk creation. It distinguishes from sibling tools like delete, list, and get comments.

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: 'ask translators questions, provide context, leave implementation notes, or flag issues.' Also mentions bulk creation for efficiency. However, lacks explicit when-not-to-use or alternative tools for related actions like editing comments.

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