UNPKG

mcp-backlog-md

Version:

An MCP (Model Context Protocol) server for the backlog.md CLI tool.

51 lines (45 loc) 1.42 kB
/** * cleanup.ts * * Purpose: * - Provides the functionality to cleanup done tasks in the backlog. * - Exposes this functionality as an MCP tool. * * Logic Overview: * - Defines an empty Zod schema as no parameters are needed. * - The `execute` function constructs a `backlog cleanup` command. * - The command is passed to the centralized `executeCommand` function. * * Last Updated: * 2025-07-21 by Cline (Refactored to use centralized command executor) */ import * as changeCase from 'change-case'; import { z } from 'zod'; import { CallToolResult } from '@modelcontextprotocol/sdk/types.js'; import { executeCommand } from '../lib/commandExecutor.js'; import { withProjectPath } from '../lib/schemas.js'; import { backlogCommand } from '../lib/utils.js'; const name = 'cleanup'; const schema = { ...withProjectPath.shape, }; // eslint-disable-next-line @typescript-eslint/no-unused-vars const zSchema = z.object(schema); async function execute(params: z.infer<typeof zSchema>): Promise<CallToolResult> { console.info('Cleaning up tasks'); const command = `${backlogCommand} cleanup`; return executeCommand({ command, successMessage: 'Cleanup successful', projectPath: params.projectPath, }); } export default { definition: { name, title: changeCase.capitalCase(name), description: 'Cleanup done tasks in backlog.md', inputSchema: schema, }, execute, };