-
Notifications
You must be signed in to change notification settings - Fork 8
feat(search): enhance search_entries tool with flexible query parameters #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(search): enhance search_entries tool with flexible query parameters #108
Conversation
- Add support for any Contentful API query parameter via catchall(z.any()) - Increase entry limit from 3 to 100 (default 10) - Add field-based searches (fields.title, fields.slug, etc.) - Add system field searches (sys.id[in], sys.createdAt, etc.) - Add metadata searches (tags) - Add full-text search capability - Maintain backward compatibility with existing parameters This enhancement enables comprehensive content discovery and filtering capabilities for AI agents working with Contentful data.
Hey Leah. Thanks for opening this PR. The Team and I are giving it a review and will provide feedback and figure out next step over the next week. |
.string() | ||
.optional() | ||
.describe('Filter by content type ID'), | ||
'sys.createdAt[gte]': z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For ISO 8601 datetimes, you can use the z.string().datetime()
for zod v3, or z.iso.date()
for zod v4
V3 https://v3.zod.dev/?id=strings | V4 https://zod.dev/api#iso-dates
.describe('Skip this many entries for pagination'), | ||
order: z.string().optional().describe('Order entries by this field'), | ||
|
||
// Full-text search (like ivo version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just use // Full-text search
as the comment here
query: { | ||
...args.query, | ||
limit: Math.min(args.query.limit || 3, 3), | ||
limit: Math.min(args.query.limit || 10, 100), // Allow up to 100 results, default 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this to a reusable fn so we don't need to duplicate the code below in the summarize data.
Something like:
function searchLimit(userLimit?: number) {
return Math.min(userLimit || 10, 100)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leahwithablackcat thanks again for putting this PR together! We've just got a few comments to check out but once addressed we'll approve and merge this.
Closing in favor of #216 |
This enhancement enables comprehensive content discovery and filtering capabilities for AI agents working with Contentful data.
Summary
Description
Motivation and Context
PR Checklist
CONTRIBUTING.md
file