search_notes
Find and retrieve Joplin notes by entering a search query and specifying result limits using the Model Context Protocol for efficient note management.
Instructions
Search for notes in Joplin.
Args:
args: Search parameters
query: Search query string
limit: Maximum number of results (default: 100)
Returns:
Dictionary containing search results
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | Yes |
Implementation Reference
- src/mcp/joplin_mcp.py:62-97 (handler)MCP tool handler for 'search_notes': decorated with @mcp.tool(), takes SearchNotesInput, calls JoplinAPI.search_notes, formats and returns results.@mcp.tool() async def search_notes(args: SearchNotesInput) -> Dict[str, Any]: """Search for notes in Joplin. Args: args: Search parameters query: Search query string limit: Maximum number of results (default: 100) Returns: Dictionary containing search results """ if not api: return {"error": "Joplin API client not initialized"} try: results = api.search_notes(query=args.query, limit=args.limit) return { "status": "success", "total": len(results.items), "has_more": results.has_more, "notes": [ { "id": note.id, "title": note.title, "body": note.body, "created_time": note.created_time.isoformat() if note.created_time else None, "updated_time": note.updated_time.isoformat() if note.updated_time else None, "is_todo": note.is_todo } for note in results.items ] } except Exception as e: logger.error(f"Error searching notes: {e}") return {"error": str(e)}
- src/mcp/joplin_mcp.py:37-41 (schema)Pydantic input schema for search_notes tool defining query (required) and limit (optional, default 100).class SearchNotesInput(BaseModel): """Input parameters for searching notes.""" query: str limit: Optional[int] = 100
- src/joplin/joplin_api.py:375-397 (helper)Core JoplinAPI helper method implementing the search_notes functionality by making a GET request to the Joplin '/search' endpoint and parsing into PaginatedResponse of JoplinNote objects.def search_notes( self, query: str, limit: int = 100 ) -> PaginatedResponse[JoplinNote]: """Search for notes. Args: query: Search query string limit: Maximum number of results Returns: PaginatedResponse containing matching JoplinNote objects """ params = { "query": query, "limit": limit } response = self._make_request("GET", "search", params=params) return PaginatedResponse( items=[JoplinNote.from_api_response(item) for item in response["items"]], has_more=response["has_more"] )