markFeaturesStale
Mark features as stale or active within a specified project using the Feature Toggle system. Manage feature lifecycle by updating stale status to align with project needs.
Instructions
Marks features as stale or not stale in the specified project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| features | Yes | ||
| projectId | Yes | ||
| stale | Yes |
Implementation Reference
- src/tools/mark-features-stale.ts:28-85 (handler)The main handler function for the markFeaturesStale tool, which logs the action, calls the underlying markFeaturesStale function from unleash, handles errors, and returns a structured JSON response.export async function handleMarkFeaturesStale({ projectId, features, stale }: { projectId: string; features: string[]; stale: boolean; }) { const action = stale ? 'stale' : 'not stale'; logger.info(`Marking ${features.length} features as ${action} in project '${projectId}'`, { projectId, features, stale }); try { const result = await markFeaturesStale(projectId, features, stale); return { content: [{ type: "text", text: JSON.stringify({ success: true, message: `Successfully marked ${features.length} features as ${action} in project '${projectId}'`, data: { features, stale, projectId } }, null, 2) }] }; } catch (error: any) { // Handle errors from the Unleash API const errorMessage = error.response?.data?.message || error.message; const status = error.response?.status; logger.error(`Failed to mark features as ${action}: ${errorMessage}`, { status, projectId, features, stale }); // Return a structured error response return { content: [{ type: "text", text: JSON.stringify({ success: false, message: `Failed to mark features as ${action}: ${errorMessage}`, status: status || 500 }, null, 2) }], isError: true }; }
- Zod schema defining the input parameters for the markFeaturesStale tool: projectId (string), features (array of strings), stale (boolean).export const MarkFeaturesStaleParamsSchema = { /** * The ID of the project containing the features */ projectId: z.string().min(1), /** * Array of feature names to mark as stale or not stale */ features: z.array(z.string().min(1)), /** * Whether to mark features as stale (true) or not stale (false) */ stale: z.boolean() };
- src/server.ts:223-228 (registration)Registration of the markFeaturesStaleTool in the MCP server instance using server.tool().server.tool( markFeaturesStaleTool.name, markFeaturesStaleTool.description, markFeaturesStaleTool.paramsSchema as any, markFeaturesStaleTool.handler as any );
- Core helper function that performs the POST request to the Unleash API endpoint /api/admin/projects/{projectId}/stale to mark features as stale or not stale.export async function markFeaturesStale( projectId: string, features: string[], stale: boolean ) { try { const endpoint = `/api/admin/projects/${projectId}/stale`; const payload = { features, stale }; const response = await client.post(endpoint, payload); const action = stale ? 'stale' : 'not stale'; logger.info(`Successfully marked ${features.length} features as ${action} in project '${projectId}'`); return response.data; } catch (error) { logger.error(`Error marking features as ${stale ? 'stale' : 'not stale'} in project '${projectId}':`, error); throw error; }