import_markdown
Import markdown files into Joplin as notes by specifying the file path, enabling easy integration and management of markdown content within the Joplin MCP Server.
Instructions
Import a markdown file as a new note.
Args:
args: Import parameters
file_path: Path to the markdown file
Returns:
Dictionary containing the created note data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | Yes |
Implementation Reference
- src/mcp/joplin_mcp.py:234-270 (handler)The main asynchronous handler function for the 'import_markdown' tool. It is decorated with @mcp.tool() for registration. Reads the markdown file using MarkdownContent.from_file, extracts title and content, creates a new note via JoplinAPI, and returns the note details.async def import_markdown(args: ImportMarkdownInput) -> Dict[str, Any]: """Import a markdown file as a new note. Args: args: Import parameters file_path: Path to the markdown file Returns: Dictionary containing the created note data """ if not api: return {"error": "Joplin API client not initialized"} try: file_path = Path(args.file_path) md_content = MarkdownContent.from_file(file_path) note = api.create_note( title=md_content.title, body=md_content.content ) 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 }, "imported_from": str(file_path) } except Exception as e: logger.error(f"Error importing markdown: {e}") return {"error": str(e)}
- src/mcp/joplin_mcp.py:57-60 (schema)Pydantic BaseModel defining the input schema for the import_markdown tool, requiring a 'file_path' parameter.class ImportMarkdownInput(BaseModel): """Input parameters for importing markdown files.""" file_path: str