Add SeqConvertFilter tool for fuzzy-to-strict filter conversion#2
Merged
willibrandon merged 7 commits intoMay 22, 2026
Merged
Conversation
Add new MCP tool that converts fuzzy filter expressions to strict Seq filter syntax. This helps users write better filter expressions by accepting natural language searches (like "error" or "timeout") and converting them to proper Seq filter expressions. The tool returns: - strictExpression: The converted filter expression - matchedAsText: Whether it was interpreted as a text search - reasonIfMatchedAsText: Explanation if treated as text search Includes tests for both successful conversions and text search fallbacks.
The assertion expected `"matchedAsText":true` but MCP's default JSON encoder escapes embedded quotes as ", so the literal substring was never present. Parse the inner content as JSON and assert on the typed values instead. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
willibrandon
left a comment
Owner
There was a problem hiding this comment.
Build is green now, thanks. A few small things worth a look, pick what you want to address.
Replaces three duplicate anonymous-object returns in SeqConvertFilter with a single SeqConvertFilterResult record. JsonPropertyName attributes preserve the existing camelCase JSON shape, and JsonIgnoreCondition.Never on ReasonIfMatchedAsText keeps the field serialized as null (rather than omitted) so the wire contract is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces two SeqConvertFilter [Fact] tests that only verified field names appeared in the JSON string with a single [Theory] that asserts the actual strictExpression, matchedAsText, and reasonIfMatchedAsText values across five inputs covering: bareword/syntax-error text-match fallback, already-strict pass-through, and fuzzy-to-strict normalization (`User=='alice'` -> `User = 'alice'`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Previously SeqConvertFilter swallowed OperationCanceledException and returned (fuzzyFilter, MatchedAsText: false, Reason: null), which is indistinguishable from a successful no-op conversion. The single-object return type has no unambiguous "empty" value (unlike the list-returning tools that return []), so cancellation now propagates to the caller. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add new MCP tool that converts fuzzy filter expressions to strict Seq filter syntax. This helps users write better filter expressions by accepting natural language searches (like "error" or "timeout") and converting them to proper Seq filter expressions.
The tool returns:
Includes tests for both successful conversions and text search fallbacks.