Skip to content

Add SeqConvertFilter tool for fuzzy-to-strict filter conversion#2

Merged
willibrandon merged 7 commits into
willibrandon:mainfrom
matt-richardson:add-seq-convert-filter
May 22, 2026
Merged

Add SeqConvertFilter tool for fuzzy-to-strict filter conversion#2
willibrandon merged 7 commits into
willibrandon:mainfrom
matt-richardson:add-seq-convert-filter

Conversation

@matt-richardson

Copy link
Copy Markdown
Contributor

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.

matt-richardson and others added 2 commits January 26, 2026 20:10
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.
Comment thread tests/SeqMcpServer.Tests/McpToolsIntegrationTests.cs Outdated
matt-richardson and others added 2 commits May 20, 2026 08:56
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 willibrandon left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build is green now, thanks. A few small things worth a look, pick what you want to address.

Comment thread src/SeqMcpServer/Mcp/SeqTools.cs Outdated
Comment thread src/SeqMcpServer/Mcp/SeqTools.cs Outdated
Comment thread tests/SeqMcpServer.Tests/McpToolsIntegrationTests.cs Outdated
matt-richardson and others added 3 commits May 22, 2026 09:08
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>
@willibrandon willibrandon merged commit 26935ef into willibrandon:main May 22, 2026
1 check passed
@willibrandon

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants