Skip to main content
Glama

response-language

Set or retrieve the response language for your project using specific parameters, ensuring compatibility with AI-driven development workflows in Cursor AI and code editors via Task Master.

Instructions

Get or set the response language for the project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
languageYesThe new response language to set. like "中文" "English" or "español".
projectRootYesThe root directory for the project. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.

Implementation Reference

  • Main execution handler for the response-language tool. Normalizes project root, executes the direct function, handles API results and errors.
    execute: withNormalizedProjectRoot(async (args, { log, session }) => {
    	try {
    		log.info(
    			`Executing response-language tool with args: ${JSON.stringify(args)}`
    		);
    
    		const result = await responseLanguageDirect(
    			{
    				...args,
    				projectRoot: args.projectRoot
    			},
    			log,
    			{ session }
    		);
    		return handleApiResult({
    			result,
    			log,
    			errorPrefix: 'Error setting response language',
    			projectRoot: args.projectRoot
    		});
    	} catch (error) {
    		log.error(`Error in response-language tool: ${error.message}`);
    		return createErrorResponse(error.message);
    	}
    })
  • Zod schema defining input parameters: projectRoot (string, required) and language (string).
    parameters: z.object({
    	projectRoot: z
    		.string()
    		.describe(
    			'The root directory for the project. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.'
    		),
    	language: z
    		.string()
    		.describe(
    			'The new response language to set. like "中文" "English" or "español".'
    		)
    }),
  • Registration function that adds the 'response-language' tool to the MCP server with name, description, schema, and handler.
    export function registerResponseLanguageTool(server) {
    	server.addTool({
    		name: 'response-language',
    		description: 'Get or set the response language for the project',
    		parameters: z.object({
    			projectRoot: z
    				.string()
    				.describe(
    					'The root directory for the project. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.'
    				),
    			language: z
    				.string()
    				.describe(
    					'The new response language to set. like "中文" "English" or "español".'
    				)
    		}),
    		execute: withNormalizedProjectRoot(async (args, { log, session }) => {
    			try {
    				log.info(
    					`Executing response-language tool with args: ${JSON.stringify(args)}`
    				);
    
    				const result = await responseLanguageDirect(
    					{
    						...args,
    						projectRoot: args.projectRoot
    					},
    					log,
    					{ session }
    				);
    				return handleApiResult({
    					result,
    					log,
    					errorPrefix: 'Error setting response language',
    					projectRoot: args.projectRoot
    				});
    			} catch (error) {
    				log.error(`Error in response-language tool: ${error.message}`);
    				return createErrorResponse(error.message);
    			}
    		})
    	});
    }
  • Direct function called by the tool handler. Manages silent mode, calls setResponseLanguage, handles errors.
    export async function responseLanguageDirect(args, log, context = {}) {
    	const { projectRoot, language } = args;
    	const mcpLog = createLogWrapper(log);
    
    	log.info(
    		`Executing response-language_direct with args: ${JSON.stringify(args)}`
    	);
    	log.info(`Using project root: ${projectRoot}`);
    
    	try {
    		enableSilentMode();
    		return setResponseLanguage(language, {
    			mcpLog,
    			projectRoot
    		});
    	} catch (error) {
    		return {
    			success: false,
    			error: {
    				code: 'DIRECT_FUNCTION_ERROR',
    				message: error.message,
    				details: error.stack
    			}
    		};
    	} finally {
    		disableSilentMode();
    	}
    }
  • Core helper function that sets the response language in the project configuration file by updating global.responseLanguage and writing the config.
    function setResponseLanguage(lang, options = {}) {
    	const { mcpLog, projectRoot } = options;
    
    	const report = (level, ...args) => {
    		if (mcpLog && typeof mcpLog[level] === 'function') {
    			mcpLog[level](...args);
    		}
    	};
    
    	// Use centralized config path finding instead of hardcoded path
    	const configPath = findConfigPath(null, { projectRoot });
    	const configExists = isConfigFilePresent(projectRoot);
    
    	log(
    		'debug',
    		`Checking for config file using findConfigPath, found: ${configPath}`
    	);
    	log(
    		'debug',
    		`Checking config file using isConfigFilePresent(), exists: ${configExists}`
    	);
    
    	if (!configExists) {
    		return {
    			success: false,
    			error: {
    				code: 'CONFIG_MISSING',
    				message:
    					'The configuration file is missing. Run "task-master init" to create it.'
    			}
    		};
    	}
    
    	// Validate response language
    	if (typeof lang !== 'string' || lang.trim() === '') {
    		return {
    			success: false,
    			error: {
    				code: 'INVALID_RESPONSE_LANGUAGE',
    				message: `Invalid response language: ${lang}. Must be a non-empty string.`
    			}
    		};
    	}
    
    	try {
    		const currentConfig = getConfig(projectRoot);
    		currentConfig.global.responseLanguage = lang;
    		const writeResult = writeConfig(currentConfig, projectRoot);
    
    		if (!writeResult) {
    			return {
    				success: false,
    				error: {
    					code: 'WRITE_ERROR',
    					message: 'Error writing updated configuration to configuration file'
    				}
    			};
    		}
    
    		return {
    			success: true,
    			data: {
    				responseLanguage: lang,
    				message: successMessage
    			}
    		};
    	} catch (error) {
    		report('error', `Error setting response language: ${error.message}`);
    		return {
    			success: false,
    			error: {
    				code: 'SET_RESPONSE_LANGUAGE_ERROR',
    				message: error.message
    			}
    		};
    	}
    }
    
    export default setResponseLanguage;
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'Get or set' operations but doesn't clarify whether this requires specific permissions, what happens when language is changed, if changes are reversible, or what the response format looks like. The description lacks crucial behavioral details for a configuration tool.

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 at just 7 words, front-loading the core purpose immediately. Every word earns its place by establishing the dual operations and target resource without any wasted language or unnecessary elaboration.

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

Completeness2/5

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

For a configuration tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'getting' the language returns, how language settings affect the project, whether changes persist, or what validation occurs. The minimal description leaves too many behavioral questions unanswered for effective agent use.

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?

With 100% schema description coverage, the baseline is 3. The description adds value by framing the tool's purpose around language configuration, which helps contextualize the 'language' parameter's role. However, it doesn't provide additional semantic context beyond what's already in the schema descriptions for individual parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs 'Get or set' and resource 'response language for the project'. It distinguishes itself from siblings by focusing on language configuration rather than task management, dependency handling, or project analysis. However, it doesn't explicitly differentiate between 'get' and 'set' operations in relation to parameters.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. There are no explicit statements about when to use 'get' versus 'set' operations, nor any mention of prerequisites or related tools. The sibling list includes many project management tools, but no language-related alternatives are mentioned.

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

Related 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/eyaltoledano/claude-task-master'

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