38 lines
3.8 KiB
Plaintext
38 lines
3.8 KiB
Plaintext
{
|
|
"description": "Query and modify your Logseq knowledge graph via the built-in REST API.",
|
|
"prompt": "## logseq\n\nQuery and modify your Logseq DB graph via the built-in REST API.\nRequires `OLLIE_LOGSEQ_TOKEN` env var and Logseq running with API server enabled.\n\n**Args**: `command` (required), plus command-specific parameters.\n\n### Commands\n\n| Command | Args | Description |\n|---------|------|-------------|\n| `getCurrentGraph` | (none) | Get current graph name and path |\n| `listPages` | `expand` (bool, optional) | List all pages; expand=true for detail |\n| `getPage` | `pageName` (required) | Get page content + blocks by name or UUID |\n| `searchBlocks` | `searchTerm` (required) | Full-text search across all blocks |\n| `listTags` | `expand` (bool, optional) | List all tags; expand=true for parents/properties |\n| `listProperties` | `expand` (bool, optional) | List all properties; expand=true for type/cardinality |\n| `upsertNodes` | `operations` (required), `dry-run` (bool, optional) | Batch create/edit pages, blocks, tags, properties |\n\n### Examples\n\n```\nlogseq(command=\"getCurrentGraph\")\nlogseq(command=\"listPages\")\nlogseq(command=\"listPages\", expand=true)\nlogseq(command=\"getPage\", pageName=\"My Page\")\nlogseq(command=\"getPage\", pageName=\"6a6c93e1-xxxx-xxxx-xxxx-xxxxxxxxxxxx\")\nlogseq(command=\"searchBlocks\", searchTerm=\"keyword\")\nlogseq(command=\"listTags\", expand=true)\nlogseq(command=\"listProperties\", expand=true)\nlogseq(command=\"upsertNodes\", operations=[...], dry-run=true)\n```\n\n### upsertNodes operations\n\nEach operation object:\n- `operation`: `\"add\"` or `\"edit\"`\n- `entityType`: `\"block\"`, `\"page\"`, `\"tag\"`, or `\"property\"`\n- `id`: UUID string (required for edit); temp string for add if referenced later\n- `data` object fields:\n - `title`: page/tag/property name or block content\n - `page-id`: page UUID (required when adding a block)\n - `tags`: list of tag UUIDs\n - `property-type`: property type (for property entities)\n - `property-cardinality`: `:one` or `:many`\n - `property-classes`: allowed tags for a property\n - `class-extends`: parent tags\n - `class-properties`: tag's properties\n\nExample — add a block to a page:\n```\nlogseq(command=\"upsertNodes\", operations=[{\"operation\":\"add\",\"entityType\":\"block\",\"id\":null,\"data\":{\"page-id\":\"<page-uuid>\",\"title\":\"New block text\"}}])\n```\n\nExample — create a page and add a block to it:\n```\nlogseq(command=\"upsertNodes\", operations=[{\"operation\":\"add\",\"entityType\":\"page\",\"id\":\"temp-inbox\",\"data\":{\"title\":\"Inbox\"}},{\"operation\":\"add\",\"entityType\":\"block\",\"id\":null,\"data\":{\"page-id\":\"temp-inbox\",\"title\":\"First item\"}}])\n```\n\n- Use `dry-run=true` to validate without committing.\n- Before creating a page/tag/property, check if it exists with `getPage`.\n- Call upsertNodes at most once per request.",
|
|
"args": {
|
|
"type": "object",
|
|
"required": ["command"],
|
|
"properties": {
|
|
"command": {
|
|
"type": "string",
|
|
"description": "Logseq API command: getCurrentGraph, listPages, getPage, searchBlocks, listTags, listProperties, upsertNodes"
|
|
},
|
|
"pageName": {
|
|
"type": "string",
|
|
"description": "Page name or UUID (for getPage)"
|
|
},
|
|
"searchTerm": {
|
|
"type": "string",
|
|
"description": "Search query (for searchBlocks)"
|
|
},
|
|
"expand": {
|
|
"type": "boolean",
|
|
"description": "Include additional detail (for listPages, listTags, listProperties)"
|
|
},
|
|
"operations": {
|
|
"type": "array",
|
|
"description": "Batch operations array (for upsertNodes)"
|
|
},
|
|
"dry-run": {
|
|
"type": "boolean",
|
|
"description": "Validate without committing (for upsertNodes)"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"tier": "hot",
|
|
"readOnly": false
|
|
}
|