search_feed
Search and sort WebSim feed content using queries with trending, newest, or popular filters to discover projects and community content.
Instructions
Search WebSim feed with sorting options
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sort | Yes | Sort method (trending, newest, or popular) | |
| search | Yes | Search query | |
| limit | No | Number of results to return (default: 20) | |
| offset | No | Number of results to skip (default: 0) |
Implementation Reference
- server.js:738-751 (handler)The handler function for the 'search_feed' tool. It validates the input arguments using FeedSearchSchema, calls the apiClient.searchFeed method with the parameters, and returns a formatted response containing the search results.handler: async (args) => { const { sort, search, limit = 20, offset = 0 } = FeedSearchSchema.parse(args); const result = await apiClient.searchFeed(sort, search, limit, offset); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Found ${result.items?.length || 0} results for "${search}" (sorted by ${sort})` }, null, 2) }] }; }
- server.js:713-737 (schema)The input schema definition for the 'search_feed' tool, specifying parameters: sort (enum: trending/newest/popular), search (string), optional limit and offset.inputSchema: { type: "object", properties: { sort: { type: "string", enum: ["trending", "newest", "popular"], description: "Sort method (trending, newest, or popular)" }, search: { type: "string", description: "Search query" }, limit: { type: "number", description: "Number of results to return (default: 20)", default: 20 }, offset: { type: "number", description: "Number of results to skip (default: 0)", default: 0 } }, required: ["sort", "search"] },
- server.js:175-178 (helper)The WebSimAPIClient method searchFeed that makes the actual API request to /api/v1/feed/search/{sort}/{search} with pagination params.async searchFeed(sort, search, limit = 20, offset = 0) { const params = new URLSearchParams({ limit: limit.toString(), offset: offset.toString() }); return this.makeRequest(`/api/v1/feed/search/${sort}/${search}?${params}`); }
- server.js:47-50 (schema)Zod validation schema used in the handler to parse required inputs: sort and search (limit/offset destructured with defaults).const FeedSearchSchema = z.object({ sort: z.enum(['trending', 'newest', 'popular']).describe('Sort method'), search: z.string().describe('Search query') });
- server.js:710-752 (registration)The full tool registration object in the tools array, including name, description, inputSchema, and handler for 'search_feed'.{ name: "search_feed", description: "Search WebSim feed with sorting options", inputSchema: { type: "object", properties: { sort: { type: "string", enum: ["trending", "newest", "popular"], description: "Sort method (trending, newest, or popular)" }, search: { type: "string", description: "Search query" }, limit: { type: "number", description: "Number of results to return (default: 20)", default: 20 }, offset: { type: "number", description: "Number of results to skip (default: 0)", default: 0 } }, required: ["sort", "search"] }, handler: async (args) => { const { sort, search, limit = 20, offset = 0 } = FeedSearchSchema.parse(args); const result = await apiClient.searchFeed(sort, search, limit, offset); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Found ${result.items?.length || 0} results for "${search}" (sorted by ${sort})` }, null, 2) }] }; } },