Skip to content

feat(cli): Create CLI tool handlers for MCP #42

@coderooz

Description

@coderooz

Summary

Create MCP tool handlers for CLI command execution.

Acceptance Criteria

  • Create \ ools/cliTools.js\ with handlers
  • Implement
    un_command\ handler
  • Implement \get_command_output\ handler
  • Implement \list_processes\ handler
  • Implement \kill_process\ handler
  • Follow existing tool handler pattern (args, config → structured response)

Tool Definitions

\\js
// run_command
{
name: 'run_command',
description: 'Execute a CLI command. Returns processId for polling. Use background=true for long-running commands.',
inputSchema: {
type: 'object',
properties: {
command: { type: 'string', description: 'Command to execute' },
args: { type: 'array', items: { type: 'string' }, description: 'Command arguments' },
cwd: { type: 'string', description: 'Working directory (within project root)' },
timeout: { type: 'number', description: 'Timeout in ms (default: 30000)' },
background: { type: 'boolean', description: 'Run in background (default: false)' }
},
required: ['command']
}
}

// get_command_output
{
name: 'get_command_output',
description: 'Get output from a running or completed command.',
inputSchema: {
type: 'object',
properties: {
processId: { type: 'string', description: 'Process ID from run_command' },
offset: { type: 'number', description: 'Output offset for large outputs' }
},
required: ['processId']
}
}

// list_processes
{
name: 'list_processes',
description: 'List all tracked CLI processes.',
inputSchema: {
type: 'object',
properties: {
status: { type: 'string', enum: ['running', 'completed', 'killed'] }
}
}
}

// kill_process
{
name: 'kill_process',
description: 'Kill a running process.',
inputSchema: {
type: 'object',
properties: {
processId: { type: 'string', description: 'Process ID to kill' },
signal: { type: 'string', enum: ['SIGTERM', 'SIGKILL'], description: 'Signal (default: SIGTERM)' }
},
required: ['processId']
}
}
\\

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions