refactor: make each subtool a top-level MCP tool#286
Open
ezyang wants to merge 1 commit intogh/ezyang/212/basefrom
Open
refactor: make each subtool a top-level MCP tool#286ezyang wants to merge 1 commit intogh/ezyang/212/basefrom
ezyang wants to merge 1 commit intogh/ezyang/212/basefrom
Conversation
ezyang
added a commit
that referenced
this pull request
May 4, 2025
In codemcp/multi_entry.py there is a POC for how to have each of the SubTools as a dedicated top level MCP tool. Let's change codemcp/main.py so we apply this for all subtools. We must worry about BC for the codemcp function in codemcp/main.py. We will remove the mcp.tool decorator but leave the function so tests don't break (we will refactor the tests later.) Let's annotate mcp.tool in each codemcp/tools/ file individually. In codemcp/tools/init_project.py there is a system_prompt which documents the tools. These should be moved into the docstring of each mcp.tool declaration. The non-tool system prompt should continue to emitted from InitProject tool. ```git-revs 65a2e52 (Base revision) 6ebb292 Add get_chat_id_from_context helper function 1d46ff5 Add Context import from mcp.server.fastmcp 7a84952 Remove mcp.tool decorator but keep function for backward compatibility 804c644 Add imports for Context, mcp, and get_chat_id_from_context a6bcd81 Add read_file to __all__ d15b9c9 Add read_file top-level MCP tool f522500 Update imports and __all__ in write_file.py 7776dc8 Add write_file top-level MCP tool f410f72 Update imports and __all__ in edit_file.py cd5539c Add edit_file top-level MCP tool 9e4d755 Update imports and __all__ in ls.py 5453bbe Add ls top-level MCP tool 7749c32 Update imports and __all__ in user_prompt.py 187fd92 Add record_user_prompt top-level MCP tool c434dd7 Update imports and __all__ in init_project.py 48ded01 Remove tool documentation from system_prompt since it's now in docstrings 84ffd44 Add initialize_project top-level MCP tool 4806639 Update imports and __all__ in think.py 8bc128b Add think_tool top-level MCP tool 2de5b3e Update imports and __all__ in grep.py fafd43c Add grep top-level MCP tool eea2b5b Update imports and __all__ in glob.py be20f9d Add glob_tool top-level MCP tool 00ae84a Update imports and __all__ in chmod.py 05cfef6 Add chmod_tool top-level MCP tool e3e2e9c Update imports and __all__ in run_command.py 8c34db2 Add run_command_tool top-level MCP tool b498258 Update imports and __all__ in rm.py 2e450af Add rm_tool top-level MCP tool 1219e18 Update imports and __all__ in mv.py 5814b30 Add mv_tool top-level MCP tool f8f4783 Update imports and __all__ in git_log.py a8483a0 Add git_log_tool top-level MCP tool 21dc859 Update imports and __all__ in git_diff.py 83a09c6 Add git_diff_tool top-level MCP tool e92b032 Update imports and __all__ in git_show.py bb57af2 Add git_show_tool top-level MCP tool 6e7b6bf Update imports and __all__ in git_blame.py 20eb2a5 Add git_blame_tool top-level MCP tool HEAD Auto-commit lint changes ``` codemcp-id: 292-refactor-make-each-subtool-a-top-level-mcp-tool ghstack-source-id: 91a150c Pull-Request-resolved: #286
Closed
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.
Stack from ghstack (oldest at bottom):
In codemcp/multi_entry.py there is a POC for how to have each of the SubTools as a dedicated top level MCP tool. Let's change codemcp/main.py so we apply this for all subtools.
We must worry about BC for the codemcp function in codemcp/main.py. We will remove the @mcp.tool decorator but leave the function so tests don't break (we will refactor the tests later.) Let's annotate @mcp.tool in each codemcp/tools/ file individually. In codemcp/tools/init_project.py there is a system_prompt which documents the tools. These should be moved into the docstring of each mcp.tool declaration. The non-tool system prompt should continue to emitted from InitProject tool.
codemcp-id: 292-refactor-make-each-subtool-a-top-level-mcp-tool