Skip to content

refactor: move MCP tools to src/tools/ directory#55

Open
fahd04 wants to merge 1 commit intodwmkerr:mainfrom
fahd04:refactor/move-tools-to-separate-files
Open

refactor: move MCP tools to src/tools/ directory#55
fahd04 wants to merge 1 commit intodwmkerr:mainfrom
fahd04:refactor/move-tools-to-separate-files

Conversation

@fahd04
Copy link

@fahd04 fahd04 commented Jan 17, 2026

Summary

This PR extracts MCP tool implementations from src/index.ts into separate files in src/tools/ directory, addressing issue #52.

Changes

New directory structure:

src/tools/
├── index.ts                  # Re-exports all tools
├── types.ts                  # Shared types and interfaces
├── shell-start.ts
├── shell-send.ts
├── shell-read.ts
├── shell-screenshot.ts
├── shell-stop.ts
├── shell-record-start.ts
└── shell-record-stop.ts

Each tool file contains:

  • Tool schema definition
  • Tool implementation function
  • Helper functions specific to that tool

Benefits

  • ✅ Reduced src/index.ts from ~700 lines to 359 lines (almost 50% reduction)
  • ✅ Better separation of concerns
  • ✅ Easier to find and modify individual tools
  • ✅ Simpler testing per tool
  • ✅ Improved code maintainability

Testing

  • ✅ All tests pass (npm test)
  • ✅ Build succeeds (npm run build)
  • ✅ Linting passes (npm run lint)
  • ✅ No functional changes - purely refactoring

Checklist

  • Follows conventional commit format
  • All tools extracted to separate files
  • Shared types moved to src/tools/types.ts
  • All tests passing
  • Linting passes
  • Build succeeds

Closes #52

Extract tool implementations from src/index.ts into separate files:
- src/tools/shell-start.ts
- src/tools/shell-send.ts
- src/tools/shell-read.ts
- src/tools/shell-screenshot.ts
- src/tools/shell-stop.ts
- src/tools/shell-record-start.ts
- src/tools/shell-record-stop.ts
- src/tools/types.ts (shared types and interfaces)
- src/tools/index.ts (re-exports all tools)

Benefits:
- Reduced src/index.ts from ~700 lines to 359 lines
- Better separation of concerns
- Easier to find and modify individual tools
- Simpler testing per tool

Resolves dwmkerr#52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: move MCP tools to src/tools/ directory

2 participants