Skip to main content
Glama
dweigend

Joplin MCP Server

by dweigend

get_note

Retrieve a specific note by its ID from Joplin to access its content and data for reading or further processing.

Instructions

Get a specific note by ID.

Args:
    note_id: ID of the note to retrieve

Returns:
    Dictionary containing the note data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
note_idYes

Implementation Reference

  • The main handler function for the 'get_note' MCP tool, decorated with @mcp.tool() which also serves as registration. It retrieves the note using JoplinAPI and returns a formatted dictionary response.
    @mcp.tool()
    async def get_note(note_id: str) -> Dict[str, Any]:
        """Get a specific note by ID.
        
        Args:
            note_id: ID of the note to retrieve
        
        Returns:
            Dictionary containing the note data
        """
        if not api:
            return {"error": "Joplin API client not initialized"}
        
        try:
            note = api.get_note(note_id)
            return {
                "status": "success",
                "note": {
                    "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
                }
            }
        except Exception as e:
            logger.error(f"Error getting note: {e}")
            return {"error": str(e)}
  • Supporting helper function in JoplinAPI class that performs the actual API call to fetch the note by ID and parses the response into a JoplinNote object.
    def get_note(self, note_id: str) -> JoplinNote:
        """Get a specific note by ID.
    
        Args:
            note_id: ID of the note to retrieve
    
        Returns:
            JoplinNote object
    
        Raises:
            requests.exceptions.RequestException: If note not found or other error
        """
        # Explizit alle wichtigen Felder anfordern, insbesondere den Body
        params = {
            "fields": "id,title,body,created_time,updated_time,is_todo"
        }
        response = self._make_request("GET", f"notes/{note_id}", params=params)
        return JoplinNote.from_api_response(response)
  • Dataclass defining the structure and type annotations for Joplin note objects, used in the tool's output processing.
    class JoplinNote:
        """Represents a Joplin note with its attributes.
    
        Reference: https://joplinapp.org/help/api/references/rest_api/#notes
    
        Attributes:
            id: Unique identifier
            title: Note title
            body: Note content in Markdown format
            created_time: Creation timestamp
            updated_time: Last update timestamp
            is_conflict: Whether this note is in conflict
            latitude: Geographic latitude
            longitude: Geographic longitude
            altitude: Geographic altitude
            author: Note author
            source_url: Source URL
            is_todo: Whether this is a todo item
            todo_due: Todo due date
            todo_completed: Todo completion date
            source: Note source
            source_application: Source application
            application_data: Application-specific data
            order: Sort order
            user_created_time: User creation timestamp
            user_updated_time: User update timestamp
            encryption_cipher_text: Encrypted content
            encryption_applied: Whether encryption is applied
            markup_language: Markup language used
            is_shared: Whether note is shared
            share_id: Share identifier
            conflict_original_id: Original note ID if in conflict
            master_key_id: Master key identifier
            parent_id: Parent folder ID
        """
    
        id: str
        title: str
        body: str | None = None
        created_time: datetime | None = None
        updated_time: datetime | None = None
        is_conflict: bool = False
        latitude: float | None = None
        longitude: float | None = None
        altitude: float | None = None
        author: str | None = None
        source_url: str | None = None
        is_todo: bool = False
        todo_due: datetime | None = None
        todo_completed: datetime | None = None
        source: str | None = None
        source_application: str | None = None
        application_data: dict[str, Any] | None = None
        order: int | None = None
        user_created_time: datetime | None = None
        user_updated_time: datetime | None = None
        encryption_cipher_text: str | None = None
        encryption_applied: bool = False
        markup_language: int | None = None
        is_shared: bool = False
        share_id: str | None = None
        conflict_original_id: str | None = None
        master_key_id: str | None = None
        parent_id: str | None = None

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/dweigend/joplin-mcp-server'

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