search-bookmarks
Search and filter your Raindrop.io bookmarks by query, tags, or collection. Sort results and paginate for efficient access to saved content.
Instructions
Search through your Raindrop.io bookmarks
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection | No | Collection ID to search in (optional, 0 for all collections) | |
| page | No | Page number (0-based, optional) | |
| perpage | No | Items per page (1-50, optional) | |
| query | Yes | Search query | |
| sort | No | Sort order (optional). Prefix with - for descending order. | |
| tags | No | Filter by tags (optional) | |
| word | No | Whether to match exact words only (optional) |
Implementation Reference
- src/index.ts:67-108 (handler)Executes the 'search-bookmarks' tool: validates input, constructs search parameters, calls Raindrop API, formats and returns results.
if (name === "search-bookmarks") { const { query, tags, page, perpage, sort, collection, word } = SearchBookmarksSchema.parse(args); const searchParams = new URLSearchParams({ search: query, ...(tags && { tags: tags.join(",") }), ...(page !== undefined && { page: page.toString() }), ...(perpage !== undefined && { perpage: perpage.toString() }), ...(sort && { sort }), ...(word !== undefined && { word: word.toString() }), }); const collectionId = collection ?? 0; const results = await api.searchBookmarks(collectionId, searchParams); const formattedResults = results.items .map( (item) => ` Title: ${item.title} URL: ${item.link} Tags: ${item.tags?.length ? item.tags.join(", ") : "No tags"} Created: ${new Date(item.created).toLocaleString()} Last Updated: ${new Date(item.lastUpdate).toLocaleString()} ---`, ) .join("\n"); return { content: [ { type: "text", text: results.items.length > 0 ? `Found ${results.count} total bookmarks (showing ${ results.items.length } on page ${page ?? 0 + 1}):\n${formattedResults}` : "No bookmarks found matching your search.", }, ], }; } - src/lib/tools.ts:31-81 (schema)MCP tool definition for 'search-bookmarks' including input schema for validation.
{ name: "search-bookmarks", description: "Search through your Raindrop.io bookmarks", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query", }, tags: { type: "array", items: { type: "string" }, description: "Filter by tags (optional)", }, page: { type: "number", description: "Page number (0-based, optional)", }, perpage: { type: "number", description: "Items per page (1-50, optional)", }, sort: { type: "string", enum: [ "-created", "created", "-last_update", "last_update", "-title", "title", "-domain", "domain", ], description: "Sort order (optional). Prefix with - for descending order.", }, collection: { type: "number", description: "Collection ID to search in (optional, 0 for all collections)", }, word: { type: "boolean", description: "Whether to match exact words only (optional)", }, }, required: ["query"], }, }, - src/index.ts:29-31 (registration)Registers the list of available tools, including 'search-bookmarks', via ListToolsRequest handler.
server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; }); - src/lib/raindrop-api.ts:46-58 (helper)Helper method in RaindropAPI that performs the API search request to Raindrop.io.
async searchBookmarks( collectionId: number, searchParams: URLSearchParams, ): Promise<SearchResponse> { return this.makeRequest<SearchResponse>( `/raindrops/${collectionId}?${searchParams.toString()}`, ); } async listCollections(): Promise<CollectionsResponse> { return this.makeRequest<CollectionsResponse>("/collections"); } } - src/types/index.ts:11-30 (schema)Zod schema for validating 'search-bookmarks' tool arguments.
export const SearchBookmarksSchema = z.object({ query: z.string(), tags: z.array(z.string()).optional(), page: z.number().min(0).optional(), perpage: z.number().min(1).max(50).optional(), sort: z .enum([ "-created", "created", "-last_update", "last_update", "-title", "title", "-domain", "domain", ]) .optional(), collection: z.number().optional(), word: z.boolean().optional(), });