refactor: consolidate MCP tools from 40 to 25#98
Conversation
- Remove 9 git tools (agents have native git access) - Merge list_sessions + list_recent_sessions + list_archived_sessions into list_sessions with filter param - Merge launch_agent + launch_headless into launch_session with headless param - Merge kill_session + kill_headless into kill_session with headless param - Merge list_workflow_runs + list_workflow_runs_by_task into list_workflow_runs with optional task_id filter - Merge get_scheduler_log + get_next_scheduled_run into get_workflow_schedule with info param - Fix write_to_terminal to auto-append carriage return Closes #93
There was a problem hiding this comment.
Pull request overview
Refactors the MCP tool surface area by removing redundant git-wrapper tools and consolidating several session/workflow tools into fewer, more flexible endpoints, reducing context/tool schema overhead for agents.
Changes:
- Consolidates workflow run listing into
list_workflow_runswith optionalworkflow_id/task_idfilters. - Consolidates scheduler tools into
get_workflow_schedulewith aninfoselector (log/next_run). - Consolidates session listing/launch/kill tools and updates
write_to_terminalto append\r.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/mcp/src/tools/workflows.ts | Merges workflow run listing + scheduler tools into consolidated APIs. |
| packages/mcp/src/tools/sessions.ts | Merges session list/launch/kill tools and tweaks terminal input behavior. |
| packages/mcp/src/tools/git.ts | Removes MCP git wrapper tools entirely. |
| packages/mcp/src/server.ts | Stops registering git tools after their removal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (args.task_id) { | ||
| const runs = listWorkflowRunsByTask(args.task_id, args.limit ?? 20) | ||
| return { content: [{ type: 'text', text: JSON.stringify(runs, null, 2) }] } | ||
| } | ||
| if (args.workflow_id) { | ||
| const runs = listWorkflowRuns(args.workflow_id, args.limit ?? 20) | ||
| return { content: [{ type: 'text', text: JSON.stringify(runs, null, 2) }] } | ||
| } |
There was a problem hiding this comment.
list_workflow_runs accepts both workflow_id and task_id, but the handler silently prioritizes task_id when both are provided. This makes the API ambiguous and can return unexpected results. Consider returning an error when both filters are set (or define a clear precedence and document/enforce it).
There was a problem hiding this comment.
Fixed — now returns an explicit error when both workflow_id and task_id are provided.
packages/mcp/src/tools/sessions.ts
Outdated
| // Append carriage return so the terminal submits the input | ||
| const data = args.data.endsWith('\r') ? args.data : args.data + '\r' | ||
| await rpcNotify('terminal:write', { id: args.id, data }) |
There was a problem hiding this comment.
Appending \r only when the input doesn't end with \r can produce \n\r when callers already include a newline (common when sending command strings ending in \n), potentially causing an extra/blank submission. Consider treating both \r and \n as “already terminated” (or normalizing to a single line ending) before appending.
There was a problem hiding this comment.
Fixed — now strips trailing \r and \n before appending a single \r, so 'text\n' becomes 'text\r' instead of 'text\n\r'.
- Reject when both workflow_id and task_id are provided in list_workflow_runs - Normalize trailing \r\n before appending \r in write_to_terminal
Summary
list_sessionswithfilterparam (active/recent/archived)launch_agent+launch_headlessintolaunch_sessionwithheadlessparamkill_session+kill_headlessintokill_sessionwithheadlessparamlist_workflow_runswith optionaltask_idfilterget_workflow_schedulewithinfoparam (log/next_run)write_to_terminalto auto-append\rso input is actually submittedBundle size: 82KB → 68KB
Closes #93
Test plan