-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparseable_list_streams.go
More file actions
31 lines (27 loc) · 1.15 KB
/
Copy pathparseable_list_streams.go
File metadata and controls
31 lines (27 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package tools
import (
"context"
"log/slog"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
)
func RegisterListDataStreamsTool(mcpServer *server.MCPServer) {
mcpServer.AddTool(mcp.NewTool(
"get_data_streams",
mcp.WithDescription("List all available data streams in Parseable. "+
"Use this tool to discover which data streams are available before executing queries. "+
"Each stream is a table-like collection of data and must be referenced by exact name in query_data_stream operations. "+
"Returns a JSON object with a 'streams' array containing stream objects with metadata (including 'name' field for the stream name) and 'count' (number of streams). "+
"All returned streams are accessible and queryable by the current user."),
), func(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
streams, err := listParseableStreams()
if err != nil {
slog.Error("failed to get response", "error", err, "tool", "get_data_streams")
return mcp.NewToolResultError(err.Error()), nil
}
return mcp.NewToolResultJSON(map[string]interface{}{
"streams": streams,
"count": len(streams),
})
})
}