feat: validate contact and group search args
This commit is contained in:
@@ -58,14 +58,18 @@ func RegisterISphereReadTools(server *mcp.Server, source ReceiveMessagesSource)
|
||||
}
|
||||
|
||||
func validateReceiveMessagesArgs(input ReceiveMessagesArgs) error {
|
||||
sourcePreference := strings.ToLower(strings.TrimSpace(input.SourcePreference))
|
||||
return validateLocalReadonlySourceAndCursor(ToolNameReceiveMessages, input.SourcePreference, input.Cursor)
|
||||
}
|
||||
|
||||
func validateLocalReadonlySourceAndCursor(toolName string, sourcePreferenceValue string, cursorValue string) error {
|
||||
sourcePreference := strings.ToLower(strings.TrimSpace(sourcePreferenceValue))
|
||||
switch sourcePreference {
|
||||
case "", "auto", "local_readonly":
|
||||
default:
|
||||
return fmt.Errorf("isphere_receive_messages source_preference %q is not available; only auto and local_readonly are supported", input.SourcePreference)
|
||||
return fmt.Errorf("%s source_preference %q is not available; only auto and local_readonly are supported", toolName, sourcePreferenceValue)
|
||||
}
|
||||
if strings.TrimSpace(input.Cursor) != "" {
|
||||
return fmt.Errorf("isphere_receive_messages cursor pagination is not available yet")
|
||||
if strings.TrimSpace(cursorValue) != "" {
|
||||
return fmt.Errorf("%s cursor pagination is not available yet", toolName)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user