Skip to main content
Glama
rossshannon

Pinboard MCP Server

by rossshannon

list_recent_bookmarks

Retrieve recently saved bookmarks from Pinboard.in by specifying how many days to look back and how many results to return.

Instructions

List bookmarks saved in the last N days.

Args: days: Number of days to look back (1-30, default 7) limit: Maximum number of results to return (1-100, default 20)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNo
limitNo

Implementation Reference

  • The main handler function for the 'list_recent_bookmarks' tool. It performs input validation, calls the PinboardClient helper, and formats the response dictionary. The @mcp.tool decorator registers it as an MCP tool.
    @mcp.tool async def list_recent_bookmarks(days: int = 7, limit: int = 20) -> dict[str, Any]: """List bookmarks saved in the last N days. Args: days: Number of days to look back (1-30, default 7) limit: Maximum number of results to return (1-100, default 20) """ if not 1 <= days <= 30: raise ValueError("Days must be between 1 and 30") if not 1 <= limit <= 100: raise ValueError("Limit must be between 1 and 100") bookmarks = await client.get_recent_bookmarks(days=days, limit=limit) return { "bookmarks": [bookmark.model_dump() for bookmark in bookmarks], "total": len(bookmarks), "days": days, }
  • Supporting helper method in PinboardClient that retrieves recent bookmarks by filtering cached bookmarks by date, sorting them, and applying the limit. Uses internal caching for efficiency.
    async def get_recent_bookmarks( self, days: int = 7, limit: int = 20 ) -> list[Bookmark]: """Get bookmarks from the last N days.""" cache_key = f"recent:{days}:{limit}" if cache_key in self._query_cache: return self._query_cache[cache_key] bookmarks = await self.get_all_bookmarks() cutoff_date = datetime.now() - timedelta(days=days) # Filter by date and sort by most recent first recent = [ bookmark for bookmark in bookmarks if bookmark.saved_at.replace(tzinfo=None) >= cutoff_date ] recent.sort(key=lambda b: b.saved_at, reverse=True) result = recent[:limit] self._query_cache[cache_key] = result return result
  • The @mcp.tool decorator on the handler function registers 'list_recent_bookmarks' as an MCP tool.
    @mcp.tool

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rossshannon/pinboard-bookmarks-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server