feat: validate contact and group search args
This commit is contained in:
@@ -12,8 +12,11 @@ import (
|
||||
const ToolNameSearchGroups = "isphere_search_groups"
|
||||
|
||||
type SearchGroupsArgs struct {
|
||||
Query string `json:"query" jsonschema:"group search query; currently matches bare group JIDs from local readonly message logs"`
|
||||
Limit int `json:"limit,omitempty" jsonschema:"maximum number of groups to return; zero or negative returns all matches"`
|
||||
Query string `json:"query" jsonschema:"group search query; currently matches bare group JIDs from local readonly message logs"`
|
||||
Limit int `json:"limit,omitempty" jsonschema:"maximum number of groups to return; zero or negative returns all matches"`
|
||||
Cursor string `json:"cursor,omitempty" jsonschema:"pagination cursor; currently only empty cursor is supported"`
|
||||
SourcePreference string `json:"source_preference,omitempty" jsonschema:"source selector; currently supports auto or local_readonly only"`
|
||||
IncludeArchived bool `json:"include_archived,omitempty" jsonschema:"accepted for contract compatibility; local readonly message logs do not expose archived state"`
|
||||
}
|
||||
|
||||
func RegisterISphereGroupTools(server *mcp.Server, source ReceiveMessagesSource) {
|
||||
@@ -25,6 +28,9 @@ func RegisterISphereGroupTools(server *mcp.Server, source ReceiveMessagesSource)
|
||||
Name: ToolNameSearchGroups,
|
||||
Description: "Search iSphere group candidates from the configured read-only message source.",
|
||||
}, func(ctx context.Context, _ *mcp.CallToolRequest, input SearchGroupsArgs) (*mcp.CallToolResult, map[string]any, error) {
|
||||
if err := validateLocalReadonlySourceAndCursor(ToolNameSearchGroups, input.SourcePreference, input.Cursor); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
started := time.Now().UTC()
|
||||
messages, err := source.ReceiveMessages(ctx, isphere.ReceiveMessagesQuery{Limit: 0})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user