Enhance MCP loading functionality by checking for directory existence
- Added a check to verify if the 'mcps' directory exists before attempting to load MCP files, improving error handling and preventing unnecessary operations. - Updated the error handling in the MCP loading function to ensure robustness in the application flow.
This commit is contained in:
parent
8bf128e3ba
commit
36e3334058
1 changed files with 7 additions and 1 deletions
|
|
@ -617,8 +617,14 @@ func loadConnector(t *testing.T, cfg config.Config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadMCP(t *testing.T, cfg config.Config) {
|
func loadMCP(t *testing.T, cfg config.Config) {
|
||||||
|
// Check if mcps directory exists
|
||||||
|
exists, err := application.App.Exists("mcps")
|
||||||
|
if err != nil || !exists {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
exts := []string{"*.mcp.yao", "*.mcp.json", "*.mcp.jsonc"}
|
exts := []string{"*.mcp.yao", "*.mcp.json", "*.mcp.jsonc"}
|
||||||
err := application.App.Walk("mcps", func(root, file string, isdir bool) error {
|
err = application.App.Walk("mcps", func(root, file string, isdir bool) error {
|
||||||
if isdir {
|
if isdir {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue