getBookmarks
Retrieve your saved bookmarks from Raindrop.io with customizable filters like tags, search, sorting, and pagination for efficient organization and access.
Instructions
Get bookmarks with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection | No | Collection ID | |
| page | No | Page number | |
| perPage | No | Items per page (max 50) | |
| search | No | Search query | |
| sort | No | Sort order | |
| tags | No | Filter by tags |
Implementation Reference
- src/services/raindrop.service.ts:130-165 (handler)Core implementation of the getBookmarks method in RaindropService class. This is the function that executes the logic to fetch bookmarks from the Raindrop.io API using openapi-fetch client, supporting various query parameters like search, collection, tags, pagination, sorting, and filters.async getBookmarks(params: { search?: string; collection?: number; tags?: string[]; important?: boolean; page?: number; perPage?: number; sort?: string; tag?: string; duplicates?: boolean; broken?: boolean; highlight?: boolean; domain?: string; } = {}): Promise<{ items: Bookmark[]; count: number }> { const query: any = {}; if (params.search) query.search = params.search; if (params.tags) query.tag = params.tags.join(','); if (params.tag) query.tag = params.tag; if (params.important !== undefined) query.important = params.important; if (params.page) query.page = params.page; if (params.perPage) query.perpage = params.perPage; if (params.sort) query.sort = params.sort; if (params.duplicates !== undefined) query.duplicates = params.duplicates; if (params.broken !== undefined) query.broken = params.broken; if (params.highlight !== undefined) query.highlight = params.highlight; if (params.domain) query.domain = params.domain; const endpoint = params.collection ? '/raindrops/{id}' : '/raindrops/0'; const options = params.collection ? { params: { path: { id: params.collection }, query } } : { params: { query } }; const { data } = await (this.client as any).GET(endpoint, options); return { items: data?.items || [], count: data?.count || 0 }; }
- MCP tool handler 'handleBookmarkSearch' (tool name: 'bookmark_search') that uses RaindropService.getBookmarks to perform bookmark search and returns MCP content links.async function handleBookmarkSearch(args: z.infer<typeof BookmarkSearchInputSchema>, { raindropService }: ToolHandlerContext) { const query: Record<string, unknown> = {}; setIfDefined(query, 'search', args.search); setIfDefined(query, 'collection', args.collection); setIfDefined(query, 'tags', args.tags); setIfDefined(query, 'important', args.important); setIfDefined(query, 'page', args.page); setIfDefined(query, 'perPage', args.perPage); setIfDefined(query, 'sort', args.sort); setIfDefined(query, 'tag', args.tag); setIfDefined(query, 'duplicates', args.duplicates); setIfDefined(query, 'broken', args.broken); setIfDefined(query, 'highlight', args.highlight); setIfDefined(query, 'domain', args.domain); const result = await raindropService.getBookmarks(query as any); const content: McpContent[] = [textContent(`Found ${result.count} bookmarks`)]; result.items.forEach((bookmark: any) => { content.push(makeBookmarkLink(bookmark)); }); return { content }; }
- MCP tool handler 'handleListRaindrops' (tool name: 'listRaindrops') that uses RaindropService.getBookmarks to list bookmarks in a specific collection.async function handleListRaindrops(args: z.infer<typeof ListRaindropsInputSchema>, { raindropService }: ToolHandlerContext) { const result = await raindropService.getBookmarks({ collection: parseInt(args.collectionId), perPage: args.limit || 50, }); const content: McpContent[] = [textContent(`Found ${result.count} bookmarks in collection`)]; result.items.forEach((bookmark: any) => content.push(makeBookmarkLink(bookmark))); return { content }; }
- Input schema (BookmarkSearchInputSchema) for the bookmark_search MCP tool, matching the parameters accepted by getBookmarks.const BookmarkSearchInputSchema = z.object({ search: z.string().optional().describe('Full-text search query'), collection: z.number().optional().describe('Collection ID to search within'), tags: z.array(z.string()).optional().describe('Tags to filter by'), important: z.boolean().optional().describe('Filter by important bookmarks'), page: z.number().optional().describe('Page number for pagination'), perPage: z.number().optional().describe('Items per page (max 50)'), sort: z.string().optional().describe('Sort order (score, title, -created, created)'), tag: z.string().optional().describe('Single tag to filter by'), duplicates: z.boolean().optional().describe('Include duplicate bookmarks'), broken: z.boolean().optional().describe('Include broken links'), highlight: z.boolean().optional().describe('Only bookmarks with highlights'), domain: z.string().optional().describe('Filter by domain'), });