chore: split mcp/tools.py into focused submodules — 1448 → 240 lines (AC-482)#589
Merged
jayscambler merged 1 commit intomainfrom Mar 31, 2026
Merged
chore: split mcp/tools.py into focused submodules — 1448 → 240 lines (AC-482)#589jayscambler merged 1 commit intomainfrom
jayscambler merged 1 commit intomainfrom
Conversation
…(AC-482) Extracted 46 tool functions from mcp/tools.py into 5 focused modules: - mcp/_base.py (67 lines) — MtsToolContext + shared helpers - mcp/agent_task_tools.py (454 lines) — agent task CRUD + evaluation - mcp/knowledge_tools.py (334 lines) — playbook/trajectory/skill reads - mcp/artifact_tools.py (229 lines) — publish/fetch/validate artifacts - mcp/distill_tools.py (167 lines) — distillation workflow - mcp/monitor_tools.py (85 lines) — monitor conditions/alerts tools.py retains scenario exploration + skill tools (240 lines) with re-exports for full backward compatibility. Also updated sdk.py to import from specific submodules and fixed test patches accordingly. 9 files changed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Split
mcp/tools.py(1,448 lines, 62 functions) into 5 focused submodules plus a shared base, reducing it to 240 lines (83% reduction).New structure
Backward compatibility
tools.pyre-exports all extracted functions via# noqa: F401imports, so all existing consumers (server/openclaw_api.py,cli.py,knowledge/,openclaw/) continue to work without changes.Also fixed
sdk.pyto import from specific submodules instead of viatoolsmodule attribute accesstests/test_sdk.pypatches to match new import pathsVerification
ruff check src— all checks passedmypy src— zero errorspytest tests/— all tests passIssue
Continues AC-482 (stages.py done in #586, mcp/tools.py done here, cli.py deferred)