{
  "_comment": "BitPub tool definitions in Anthropic/OpenAI format. Drop into any agent that supports tool/function calling. Works with LangChain, CrewAI, smolagents, raw Claude API, raw OpenAI API, AutoGen, and any other framework that accepts this schema.",
  "_auth": "Set BITPUB_API_KEY and BITPUB_DOMAIN env vars, or ensure ~/.bitpub/config.json exists.",
  "_endpoint": "https://bitpub.io",
  "tools": [
    {
      "name": "bitpub_read",
      "description": "Read context from BitPub's shared memory — meeting notes, blog posts, internal docs, company briefs. Use address paths like 'Meetings/External/Reuters/**' or 'Blog/**'. Wildcards: * matches one segment, ** matches any depth. Always call bitpub_list first if you don't know what paths exist.",
      "input_schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Address path or pattern. Examples: 'Meetings/External/Reuters/**', 'Blog/**', 'Config/Writing-Style', 'Meetings/**'"
          },
          "limit": {
            "type": "integer",
            "description": "Max slices to return (default 50)",
            "default": 50
          }
        },
        "required": ["path"]
      }
    },
    {
      "name": "bitpub_list",
      "description": "List available namespaces and context slices in BitPub. Start here when you don't know what context is available. Returns all address paths under the given prefix.",
      "input_schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Namespace prefix to list. Use '**' for everything, or 'Meetings/**' for meetings only.",
            "default": "**"
          }
        }
      }
    },
    {
      "name": "bitpub_search",
      "description": "Search BitPub for context matching a query. Searches content text and address paths. Returns matching slices with source paths. Use this when you want everything about a company, person, or topic without knowing exactly where it lives.",
      "input_schema": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Search query. Examples: 'Reuters', 'scraper audit', 'paywall bypass', 'agent site'"
          },
          "path": {
            "type": "string",
            "description": "Namespace to search within. Default '**' searches everything.",
            "default": "**"
          }
        },
        "required": ["query"]
      }
    },
    {
      "name": "bitpub_push",
      "description": "Write a context slice to BitPub. Use this to save agent-generated outputs (briefs, summaries, analysis) so teammates and other agents can read them. Content should be markdown.",
      "input_schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Where to write. Use a descriptive path like 'Briefs/Reuters' or 'Analysis/scraper-market-2026'."
          },
          "content": {
            "type": "string",
            "description": "Markdown content to store."
          },
          "tags": {
            "type": "string",
            "description": "Comma-separated tags, e.g. 'brief,reuters,agent-generated'"
          },
          "append": {
            "type": "boolean",
            "description": "Append to existing slice instead of overwriting (default false)",
            "default": false
          }
        },
        "required": ["path", "content"]
      }
    }
  ],
  "openai_format": {
    "_note": "Same tools in OpenAI function-calling format (for LangChain, AutoGen, OpenAI SDK, etc.)",
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "bitpub_read",
          "description": "Read context from BitPub's shared memory. Use address paths like 'Meetings/External/Reuters/**' or 'Blog/**'. Wildcards supported.",
          "parameters": {
            "type": "object",
            "properties": {
              "path": { "type": "string", "description": "Address path or pattern" },
              "limit": { "type": "integer", "description": "Max slices (default 50)" }
            },
            "required": ["path"]
          }
        }
      },
      {
        "type": "function",
        "function": {
          "name": "bitpub_list",
          "description": "List available namespaces in BitPub.",
          "parameters": {
            "type": "object",
            "properties": {
              "path": { "type": "string", "description": "Namespace prefix, default '**'" }
            }
          }
        }
      },
      {
        "type": "function",
        "function": {
          "name": "bitpub_search",
          "description": "Full-text search across BitPub.",
          "parameters": {
            "type": "object",
            "properties": {
              "query": { "type": "string", "description": "Search query" },
              "path": { "type": "string", "description": "Namespace to search, default '**'" }
            },
            "required": ["query"]
          }
        }
      },
      {
        "type": "function",
        "function": {
          "name": "bitpub_push",
          "description": "Write a context slice to BitPub.",
          "parameters": {
            "type": "object",
            "properties": {
              "path": { "type": "string", "description": "Destination path" },
              "content": { "type": "string", "description": "Markdown content" },
              "tags": { "type": "string", "description": "Comma-separated tags" },
              "append": { "type": "boolean", "description": "Append instead of overwrite" }
            },
            "required": ["path", "content"]
          }
        }
      }
    ]
  }
}
