Skip to main content
Glama

rename_tag

Update tag names in task management files to improve organization and clarity. Specify the old and new tag names along with the project directory for precise renaming.

Instructions

Rename an existing tag

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileNoPath to the tasks file (default: tasks/tasks.json)
newNameYesNew name for the tag
oldNameYesCurrent name of the tag to rename
projectRootYesThe directory of the project. Must be an absolute path.

Implementation Reference

  • MCP tool handler execute function for 'rename_tag'. Normalizes project root, finds tasks.json path, calls renameTagDirect, handles result and errors.
    	execute: withNormalizedProjectRoot(async (args, { log, session }) => {
    		try {
    			log.info(`Starting rename-tag with args: ${JSON.stringify(args)}`);
    
    			// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
    			let tasksJsonPath;
    			try {
    				tasksJsonPath = findTasksPath(
    					{ projectRoot: args.projectRoot, file: args.file },
    					log
    				);
    			} catch (error) {
    				log.error(`Error finding tasks.json: ${error.message}`);
    				return createErrorResponse(
    					`Failed to find tasks.json: ${error.message}`
    				);
    			}
    
    			// Call the direct function
    			const result = await renameTagDirect(
    				{
    					tasksJsonPath: tasksJsonPath,
    					oldName: args.oldName,
    					newName: args.newName,
    					projectRoot: args.projectRoot
    				},
    				log,
    				{ session }
    			);
    
    			return handleApiResult({
    				result,
    				log: log,
    				errorPrefix: 'Error renaming tag',
    				projectRoot: args.projectRoot
    			});
    		} catch (error) {
    			log.error(`Error in rename-tag tool: ${error.message}`);
    			return createErrorResponse(error.message);
    		}
    	})
    });
  • Input schema definition for the 'rename_tag' tool using Zod, including parameters oldName, newName, file (optional), projectRoot.
    name: 'rename_tag',
    description: 'Rename an existing tag',
    parameters: z.object({
    	oldName: z.string().describe('Current name of the tag to rename'),
    	newName: z.string().describe('New name for the tag'),
    	file: z
    		.string()
    		.optional()
    		.describe('Path to the tasks file (default: tasks/tasks.json)'),
    	projectRoot: z
    		.string()
    		.describe('The directory of the project. Must be an absolute path.')
    }),
  • Registration mapping for 'rename_tag' tool to its registerRenameTagTool function in the central tool registry.
    rename_tag: registerRenameTagTool,
  • Core helper function renameTagDirect called by the MCP handler. Validates args, enables silent mode, calls underlying renameTag, returns structured result.
    export async function renameTagDirect(args, log, context = {}) {
    	// Destructure expected args
    	const { tasksJsonPath, oldName, newName, projectRoot } = args;
    	const { session } = context;
    
    	// Enable silent mode to prevent console logs from interfering with JSON response
    	enableSilentMode();
    
    	// Create logger wrapper using the utility
    	const mcpLog = createLogWrapper(log);
    
    	try {
    		// Check if tasksJsonPath was provided
    		if (!tasksJsonPath) {
    			log.error('renameTagDirect called without tasksJsonPath');
    			disableSilentMode();
    			return {
    				success: false,
    				error: {
    					code: 'MISSING_ARGUMENT',
    					message: 'tasksJsonPath is required'
    				}
    			};
    		}
    
    		// Check required parameters
    		if (!oldName || typeof oldName !== 'string') {
    			log.error('Missing required parameter: oldName');
    			disableSilentMode();
    			return {
    				success: false,
    				error: {
    					code: 'MISSING_PARAMETER',
    					message: 'Old tag name is required and must be a string'
    				}
    			};
    		}
    
    		if (!newName || typeof newName !== 'string') {
    			log.error('Missing required parameter: newName');
    			disableSilentMode();
    			return {
    				success: false,
    				error: {
    					code: 'MISSING_PARAMETER',
    					message: 'New tag name is required and must be a string'
    				}
    			};
    		}
    
    		log.info(`Renaming tag from "${oldName}" to "${newName}"`);
    
    		// Call the renameTag function
    		const result = await renameTag(
    			tasksJsonPath,
    			oldName,
    			newName,
    			{}, // options (empty for now)
    			{
    				session,
    				mcpLog,
    				projectRoot
    			},
    			'json' // outputFormat - use 'json' to suppress CLI UI
    		);
    
    		// Restore normal logging
    		disableSilentMode();
    
    		return {
    			success: true,
    			data: {
    				oldName: result.oldName,
    				newName: result.newName,
    				renamed: result.renamed,
    				taskCount: result.taskCount,
    				wasCurrentTag: result.wasCurrentTag,
    				message: `Successfully renamed tag from "${result.oldName}" to "${result.newName}"`
    			}
    		};
    	} catch (error) {
    		// Make sure to restore normal logging even if there's an error
    		disableSilentMode();
    
    		log.error(`Error in renameTagDirect: ${error.message}`);
    		return {
    			success: false,
    			error: {
    				code: error.code || 'RENAME_TAG_ERROR',
    				message: error.message
    			}
    		};
    	}
    }
  • Import and re-export of renameTagDirect in central core module, also added to directFunctions Map at line 76.
    import { renameTagDirect } from './direct-functions/rename-tag.js';
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Rename an existing tag' implies a mutation operation, but it doesn't disclose whether this requires specific permissions, whether the rename is atomic or affects dependent tasks, what happens on conflicts (e.g., duplicate new names), or error behavior. For a mutation tool with zero annotation coverage, this is a significant gap.

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 a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse. Every word earns its place without redundancy.

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?

Given this is a mutation tool with no annotations and no output schema, the description is inadequate. It doesn't explain what happens after renaming (e.g., returns success/failure, updates task references), potential side effects, or error handling. For a tool that modifies data, more context is needed to use it safely and effectively.

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 all four parameters (oldName, newName, projectRoot, file) with clear descriptions. The description adds no additional meaning beyond what's in the schema, such as format examples or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

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 'Rename an existing tag' clearly states the verb (rename) and resource (tag), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'copy_tag' or 'delete_tag' that also operate on tags, nor does it specify what system or context these tags exist in (e.g., task management system).

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 like 'copy_tag' or 'delete_tag'. There's no mention of prerequisites (e.g., the tag must exist), error conditions, or typical workflows. The agent must infer usage from the tool name and parameters alone.

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