Fix handling of multi path resources#1458
Conversation
…cp-server into omgitsads/go-sdk-repo-resources
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the handling of multi-path resources in URI templates by properly extracting path components from uritemplate.Value. The issue was that String() doesn't work for multi-segment paths with capture groups - the proper approach is to check if the value is a list and handle both cases accordingly.
Key Changes:
- Fixed path extraction logic in
RepositoryResourceContentsHandlerto handle both single path values and multi-segment paths usingList()andString()methods - Added new utility functions for creating tool results in
pkg/utils/result.go - Migrated from
mark3labs/mcp-gotomodelcontextprotocol/go-sdkthroughout the codebase - Updated third-party license files to reflect dependency changes
Reviewed Changes
Copilot reviewed 90 out of 91 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/github/repository_resource.go |
Fixed multi-path URI template handling by checking for list values and joining path components |
pkg/github/repository_resource_test.go |
Refactored tests to use new SDK patterns and added multi-path test case |
pkg/utils/result.go |
Added utility functions for creating MCP tool results |
pkg/toolsets/toolsets.go |
Migrated to new MCP SDK with updated type definitions |
pkg/log/io.go |
Added Close method to IOLogger |
pkg/github/*.go |
Large-scale migration from old MCP SDK to new one |
| Third-party license files | Updated to reflect dependency changes (removed old deps, added new ones) |
| return mcp.NewToolResultError(err.Error()), nil | ||
| } | ||
| func GetDependabotAlert(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { | ||
| tool := mcp.Tool{ |
There was a problem hiding this comment.
This definition of tool is never used.
| return mcp.NewToolResultError(err.Error()), nil | ||
| } | ||
| func ListDependabotAlerts(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { | ||
| tool := mcp.Tool{ |
There was a problem hiding this comment.
This definition of tool is never used.
| return mcp.NewToolResultError(err.Error()), nil | ||
| } | ||
| func ListGists(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { | ||
| tool := mcp.Tool{ |
There was a problem hiding this comment.
This definition of tool is never used.
| return mcp.NewToolResultError(err.Error()), nil | ||
| } | ||
| func GetGist(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { | ||
| tool := mcp.Tool{ |
There was a problem hiding this comment.
This definition of tool is never used.
| return mcp.NewToolResultError(err.Error()), nil | ||
| } | ||
| func CreateGist(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { | ||
| tool := mcp.Tool{ |
There was a problem hiding this comment.
This definition of tool is never used.
Follow up to #1457, as I missed that
uritemplate.Valueseparates the capture group andString()doesn't work.