# superdoc_search

Find text patterns or nodes in the document and get ref handles for targeting edits and formatting. Refs expire after any mutation that changes the document. Re-search before the next edit when using individual tools (superdoc_edit, superdoc_format). Within a superdoc_mutations batch, selectors in "where" clauses resolve automatically at compile time; no manual re-searching needed between steps. Text search returns handle.ref covering only the matched substring. Node search finds blocks by type (paragraph, heading, table, listItem, etc.). The "require" parameter controls match cardinality: "first" returns one match, "all" returns every match, "exactlyOne" fails if not exactly one match. Supports scoping via "within" to search inside a single block. Patterns are plain text by default; pass select.mode: "regex" for regular-expression search (g/gi semantics, 1024-char cap, no wholeWord, capture groups returned on matches). Invalid or unsafe patterns fail with INVALID_INPUT. Do NOT use markdown formatting markers (#, , etc.) in search patterns. Do NOT use this tool when you already have a ref from superdoc_get_content blocks or superdoc_create; use that ref directly. EXAMPLES: 1. {"select":{"type":"text","pattern":"Introduction"},"require":"first"} 2. {"select":{"type":"text","pattern":"total amount"},"require":"all"} 3. {"select":{"type":"node","nodeType":"heading"},"require":"all"} 4. {"select":{"type":"text","pattern":"contract"},"within":{"kind":"block","nodeType":"paragraph","nodeId":"abc123"},"require":"first"}

Agent View of the PolicyLayer registry record for `superdoc_search`. HTML page: https://policylayer.com/tools/superdoc-mcp/superdoc-search

## Facts

- Tool: `superdoc_search`
- Server: Superdoc (`@superdoc/mcp`) — https://policylayer.com/tools/superdoc-mcp.md
- Install: `npx -y @superdoc/mcp`
- Homepage: https://www.npmjs.com/package/@superdoc/mcp
- Risk category: Read (Low risk)
- Registry record: grade F, identity unverified
- Server rate-limited: no
- Parameters: 9 (2 required)
- Recommended policy verdict: Allowed

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `in` | object | no | Story scope. Defaults to document body when omitted. Use {kind:'story', storyType:'body'} for body, or other storyType values for headers, footers, footnotes, e |
| `mode` | string | no | Search mode: 'strict' (default, exact matching) or 'candidates' (returns scored potential matches). |
| `limit` | integer | no | Maximum number of matches to return. |
| `offset` | integer | no | Number of matches to skip for pagination. |
| `select` | object | yes | Search selector. Use {type:'text', pattern:'...'} for text search or {type:'node', nodeType:'paragraph'\|'heading'\|...} for node search. |
| `within` | object | no | Limit search scope to within a specific block: {kind:'block', nodeType:'...', nodeId:'...'}. |
| `require` | string | no | Match cardinality: 'any' (all matches), 'first' (only first), 'exactlyOne' (fail if != 1), 'all' (fail if 0). |
| `session_id` | string | yes | Session ID from superdoc_open. |
| `includeNodes` | boolean | no | When true, includes full node data in results. Default: false. |

Parameters from the server's own tool schema.

## Example call (MCP tools/call, JSON-RPC 2.0)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "superdoc_search",
    "arguments": {
      "select": {},
      "session_id": "<session_id>"
    }
  }
}
```

## Why superdoc_search is rated Low

Even though superdoc_search only reads data, uncontrolled read access leaks sensitive information and racks up API costs: an agent caught in a retry loop can make thousands of calls a minute without anyone noticing.

Risk signals: High parameter count (13 properties)

## Use case

AI agents call superdoc_search to retrieve information from Superdoc without modifying anything. It is typically the context-gathering step in research, monitoring, and reporting workflows, before the agent takes action elsewhere.

## Recommended policy (PolicyLayer)

Verdict: **Allowed**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches Superdoc:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "superdoc_search": {}
  }
}
```

## Other tools on Superdoc (12)

- `superdoc_mutations` — Destructive — https://policylayer.com/tools/superdoc-mcp/superdoc-mutations.md
- `superdoc_table` — Destructive — https://policylayer.com/tools/superdoc-mcp/superdoc-table.md
- `superdoc_track_changes` — Destructive — https://policylayer.com/tools/superdoc-mcp/superdoc-track-changes.md
- `superdoc_format` — Execute — https://policylayer.com/tools/superdoc-mcp/superdoc-format.md
- `superdoc_get_content` — Read — https://policylayer.com/tools/superdoc-mcp/superdoc-get-content.md
- `superdoc_list` — Read — https://policylayer.com/tools/superdoc-mcp/superdoc-list.md
- `superdoc_close` — Write — https://policylayer.com/tools/superdoc-mcp/superdoc-close.md
- `superdoc_comment` — Write — https://policylayer.com/tools/superdoc-mcp/superdoc-comment.md
- `superdoc_create` — Write — https://policylayer.com/tools/superdoc-mcp/superdoc-create.md
- `superdoc_edit` — Write — https://policylayer.com/tools/superdoc-mcp/superdoc-edit.md
- `superdoc_open` — Write — https://policylayer.com/tools/superdoc-mcp/superdoc-open.md
- `superdoc_save` — Write — https://policylayer.com/tools/superdoc-mcp/superdoc-save.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=superdoc-mcp · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/superdoc-mcp
