UNPKG

sonatype-mcp

Version:

Model Context Protocol server for Sonatype Nexus Repository Manager

44 lines (43 loc) 1.29 kB
import { formatMCPError } from '../../utils/errors.js'; /** * List tasks tool */ export function createListTasksTool(adminService) { return { name: 'nexus_list_tasks', description: 'List all scheduled tasks', inputSchema: { type: 'object', properties: {}, additionalProperties: false }, handler: async (_params) => { try { const tasks = await adminService.listTasks(); return { content: [ { type: 'text', text: JSON.stringify({ tasks, count: tasks.length }, null, 2) } ] }; } catch (error) { const mcpError = formatMCPError(error); return { content: [ { type: 'text', text: `Error listing tasks: ${mcpError.message}` } ], isError: true }; } } }; }