refactor: convert projects, labels, and dynamic_tools to NewTool pattern #1601
+1,031
−937
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
This PR converts projects.go, labels.go, and dynamic_tools.go from the legacy
NewServerToolLegacywrapper pattern to the newNewToolpattern with properToolDependencies.Part of the ongoing effort to eliminate all
NewServerToolLegacyusages in the codebase.Changes
projects.go
NewToolwithToolHandlerFor[map[string]any, any]and 3-return-value handlersListProjects,GetProject,ListProjectFields,GetProjectField,ListProjectItems,GetProjectItem,AddProjectItem,UpdateProjectItem,DeleteProjectItemprojects_test.go
serverTool.Handler(deps)patternmockClientdeclarationsToolHandlerwhich only has 2 returns)labels.go
GetLabel,ListLabels, andLabelWritetoNewToolpatternlabels_test.go
dynamic_tools.go
ListAvailableToolsets,GetToolsetsTools, andEnableToolsetto returnServerTooldirectlyNewServerToolLegacyinternally since they have special dependencies (*mcp.Server,*toolsets.ToolsetGroup) that cannot be handled byToolDependenciestools.go
NewServerToolLegacywrappers for dynamic tools registration since the functions now returnServerTooldirectlyTesting
script/test)script/lint)Stacked PR
This PR targets
SamMorrowDrums/server-tool-refactor-security-advisories(#1600) and should be merged after that PR.Co-authored-by: Adam Holt omgitsads@users.noreply.github.com