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';

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