From e5eab9869918ff9b21e9afd3df06531f208b76b2 Mon Sep 17 00:00:00 2001 From: Ollie Agent Date: Sun, 16 Aug 2026 10:42:05 +0200 Subject: [PATCH] remove logseq tool --- data/tools/logseq | 80 ------------------------------------------ data/tools/logseq.meta | 37 ------------------- 2 files changed, 117 deletions(-) delete mode 100755 data/tools/logseq delete mode 100644 data/tools/logseq.meta diff --git a/data/tools/logseq b/data/tools/logseq deleted file mode 100755 index cd64f15..0000000 --- a/data/tools/logseq +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python3 -"""Logseq tool — queries and modifies Logseq DB graph via the REST API.""" - -import json -import os -import subprocess -import sys - -sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) -from _lib.args import parse_args - -LOGSEQ_URL = os.environ.get("LOGSEQ_MCP_URL", "http://127.0.0.1:12315") -TOKEN = os.environ.get("OLLIE_LOGSEQ_TOKEN", "") - -# Map tool commands to REST API methods and argument shapes. -COMMANDS = { - "listPages": ("logseq.cli.listPages", lambda a: [{"expand": a.get("expand", False)}]), - "getPage": ("logseq.cli.getPageData", lambda a: [a["pageName"]]), - "searchBlocks": ("logseq.app.search", lambda a: [a["searchTerm"], {"enable-snippet?": False}]), - "listTags": ("logseq.cli.listTags", lambda a: [{"expand": a.get("expand", False)}]), - "listProperties": ("logseq.cli.listProperties", lambda a: [{"expand": a.get("expand", False)}]), - "upsertNodes": ("logseq.cli.upsertNodes", lambda a: [a["operations"], {"dry-run": a.get("dry-run", False)}]), - "getCurrentGraph":("logseq.app.getCurrentGraph", lambda a: []), -} - - -def main(): - if not TOKEN: - print("Error: OLLIE_LOGSEQ_TOKEN not set", file=sys.stderr) - sys.exit(1) - - args = parse_args() - raw = args.raw() - command = args.require("command") - - if command not in COMMANDS: - print(f"Error: unknown command '{command}'. Available: {', '.join(sorted(COMMANDS.keys()))}", file=sys.stderr) - sys.exit(1) - - method, build_args = COMMANDS[command] - - # Remove 'command' from raw args before passing to builder. - params = {k: v for k, v in raw.items() if k != "command"} - try: - api_args = build_args(params) - except KeyError as e: - print(f"Error: missing required argument {e}", file=sys.stderr) - sys.exit(1) - - # Build the REST API request. - payload = {"method": method} - if api_args: - payload["args"] = api_args - - result = subprocess.run( - ["curl", "-s", "-X", "POST", - f"{LOGSEQ_URL}/api", - "-H", f"Authorization: Bearer {TOKEN}", - "-H", "Content-Type: application/json", - "-d", json.dumps(payload)], - capture_output=True, text=True, timeout=30 - ) - - if result.returncode != 0: - print(f"Error: curl failed: {result.stderr}", file=sys.stderr) - sys.exit(1) - - # Output the result. - output = result.stdout.strip() - if output: - # Pretty-print JSON if possible. - try: - data = json.loads(output) - print(json.dumps(data, indent=2, ensure_ascii=False)) - except json.JSONDecodeError: - print(output) - - -if __name__ == "__main__": - main() diff --git a/data/tools/logseq.meta b/data/tools/logseq.meta deleted file mode 100644 index 9b16f1a..0000000 --- a/data/tools/logseq.meta +++ /dev/null @@ -1,37 +0,0 @@ -{ - "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\":\"\",\"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", - "scope": "global" -}