Skip to content

refactor(mcp): split skill tool handler into its own module - #319

Merged
getappz merged 1 commit into
masterfrom
task/336
Jul 25, 2026
Merged

refactor(mcp): split skill tool handler into its own module#319
getappz merged 1 commit into
masterfrom
task/336

Conversation

@getappz

@getappz getappz commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move skill()'s search/load bodies out of mcp_server.rs into src/mcp_server/skill.rs, matching the one-file-per-tool convention already used by item.rs/claim.rs/comment.rs/handoff.rs/memory_tool.rs/review.rs/search.rs/artifact.rs/asset.rs/flare_docs.rs/flare_git.rs.
  • No behavior change — bodies moved verbatim, skill() is now a thin self.skill_impl(req).await dispatch.

Salvaged from a review of stale branch task/29 (agentflare item #29, cancelled as superseded — its McpTool trait/registry port was dead code and the premise itself is superseded by this exact per-tool-module convention). This PR covers only the one genuinely reusable idea from that review: agentflare item #336.

Test plan

  • cargo build — clean
  • cargo fmt --check — clean
  • cargo test --bin agentflare mcp_server — 126 passed, 0 failed (incl. skill_search_empty_query_is_invalid_params, skill_search_mode_rejects_unknown_value, skill_load_unknown_name_reports_not_found_with_search_hint)
  • cargo clippy --workspace --all-features -- -D warnings — pre-existing daemon_autostart.rs dead-code errors confirmed present on plain master too, unrelated to this change

Summary by CodeRabbit

  • New Features
    • Added skill search functionality with support for query matching modes and configurable result limits.
    • Added skill loading by name, including optional activation guidance and companion script details.
    • Improved error handling for missing, ambiguous, invalid, or unknown skill requests.

Move skill()'s search/load bodies into src/mcp_server/skill.rs,
matching the one-file-per-tool convention already used by
item.rs/claim.rs/comment.rs/handoff.rs/memory_tool.rs/review.rs/
search.rs/artifact.rs/asset.rs/flare_docs.rs/flare_git.rs.

Agentflare-Agent: claude-code_2-1-218_agent
Agentflare-Branch: task/336
Agentflare-Item: 336
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 51612057-d95e-49f3-8b49-942048c54abb

📥 Commits

Reviewing files that changed from the base of the PR and between 8a48eaf and 155b994.

📒 Files selected for processing (2)
  • src/mcp_server.rs
  • src/mcp_server/skill.rs

📝 Walkthrough

Walkthrough

The MCP skill tool’s search and load dispatch is extracted from src/mcp_server.rs into src/mcp_server/skill.rs. The new handler preserves validation, registry operations, error mapping, JSON serialization, and optional activation-wrapper formatting.

Changes

Skill handler refactor

Layer / File(s) Summary
Skill action implementation
src/mcp_server/skill.rs
skill_impl handles search and load actions, including validation, registry queries, error mapping, JSON serialization, and optional activation-wrapper output.
Skill tool wiring
src/mcp_server.rs
The new module is registered and the MCP skill tool delegates requests to skill_impl.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • getappz/agentflare#92: Introduces the skill registry and related skill search/load functionality used by this handler.
  • getappz/agentflare#185: Consolidates the MCP skill endpoint around action-dispatched SkillRequest handling.
  • getappz/agentflare#253: Establishes the pattern of splitting MCP tool implementations into dedicated modules.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: moving the skill tool handler into its own module.
Description check ✅ Passed The PR includes a clear summary and test plan, covering the main change and validation steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/336

Comment @coderabbitai help to get the list of available commands.

@getappz
getappz merged commit f696e27 into master Jul 25, 2026
17 checks passed
@getappz
getappz deleted the task/336 branch July 25, 2026 02:58
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.

1 participant