Skip to content

Commit 08c080d

Browse files
committed
fix(read_multple_files): add missing items property
1 parent c16b3d7 commit 08c080d

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

filesystemserver/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ func NewFilesystemServer(allowedDirs []string) (*server.MCPServer, error) {
127127
mcp.WithArray("paths",
128128
mcp.Description("List of file paths to read"),
129129
mcp.Required(),
130+
mcp.Items(map[string]any{"type": "string"}),
130131
),
131132
), h.handleReadMultipleFiles)
132133

filesystemserver/server_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package filesystemserver_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/mark3labs/mcp-filesystem-server/filesystemserver"
7+
"github.com/stretchr/testify/assert"
8+
"github.com/stretchr/testify/require"
9+
)
10+
11+
// regression test for invalid schema => missing items in array definition
12+
func TestReadMultipleFilesSchema(t *testing.T) {
13+
fsserver, err := filesystemserver.NewFilesystemServer([]string{t.TempDir()})
14+
require.NoError(t, err)
15+
16+
mcpClient := startTestClient(t, fsserver)
17+
18+
tool := getTool(t, mcpClient, "read_multiple_files")
19+
require.NotNil(t, tool)
20+
21+
// make sure that the tool has the correct schema
22+
paths, ok := tool.InputSchema.Properties["paths"]
23+
assert.True(t, ok)
24+
pathsMap, ok := paths.(map[string]any)
25+
assert.True(t, ok)
26+
_, ok = pathsMap["items"]
27+
assert.True(t, ok)
28+
}

0 commit comments

Comments
 (0)