Skip to content

Conversation

@GuanyiLi-Craig
Copy link
Contributor

improve tool registry

Copilot AI review requested due to automatic review settings December 29, 2025 21:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the tool registry and discovery system, replacing the old adapter-based architecture with a simpler, more direct approach. The changes consolidate tool registration into a new humcp package with a decorator-based system that auto-discovers tools at startup.

Key Changes

  • New architecture: Removed the adapter layer (FastMCPFastAPIAdapter, RouteGenerator) in favor of a direct decorator-based tool registry with unified route generation
  • Simplified tool registration: Tools now use @tool() decorator from src.humcp.decorator with automatic name generation from category and function name
  • Streamlined server creation: Consolidated server initialization into src.humcp.server.create_app() with automatic tool discovery and both REST and MCP endpoint registration

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/humcp/registry.py New tool registry module with ToolRegistration dataclass and global registry
src/humcp/decorator.py New @tool decorator for registering tools with automatic category detection
src/humcp/routes.py New REST route generation with schema extraction from type hints
src/humcp/server.py New unified app creation with automatic tool discovery and MCP integration
src/humcp/__init__.py Empty init file for the new humcp package
src/main.py Simplified entry point using create_app()
src/tools/local/calculator.py Updated tool names from calculator_add to add (and similarly for other calculator tools)
src/tools/local/local_file_system.py Updated import to use src.humcp.decorator
src/tools/local/shell.py Updated import to use src.humcp.decorator
src/tools/data/csv.py Updated import and tool names (e.g., csv_list_csv_files to list_csv_files)
src/tools/data/pandas.py Updated import and tool names with pandas prefix removed
src/tools/files/pdf_to_markdown.py Updated import to use src.humcp.decorator
src/tools/search/tavily_tool.py Updated import and renamed from web_search to tavily_web_search
src/tools/__init__.py Removed old decorator and registry (replaced by src/humcp/)
src/adapter/ Removed entire adapter package (no longer needed)
src/mcp_register.py Removed old MCP registration logic (replaced by server.create_app())
tests/humcp/test_models.py New tests for model generation from schemas
tests/humcp/test_decorator.py New tests for the @tool decorator and registration
tests/humcp/__init__.py Test package init file
tests/adapter/ Removed old adapter tests (adapter removed)
README.md Updated documentation to reflect new architecture and usage patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 29, 2025 21:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 26 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

GuanyiLi-Craig and others added 4 commits December 29, 2025 22:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@GuanyiLi-Craig GuanyiLi-Craig merged commit fb9abca into main Dec 30, 2025
4 checks passed
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.

2 participants