edit_lines
Replace exact lines in a Scrapbox page with new content, supporting multi-line replacements and optional replacement of all matches.
Instructions
Replace one or more lines in a Scrapbox page on cosense (scrapbox). Matches the target by exact text and substitutes it with new content (which may span multiple lines). If targetLineText contains newline characters, it is matched as a contiguous block of lines, so any n lines can be replaced with m lines. By default only the first match is replaced; set matchAll to replace every (non-overlapping) occurrence. Returns an error if no match is found. Requires COSENSE_MCP_PAT or COSENSE_SID. Uses my-cosense-project project as default if projectName is not specified.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | Content format of newText. 'markdown' (default) converts Markdown to Scrapbox syntax. 'scrapbox' passes content through as-is, preserving Scrapbox-native indentation and syntax. | |
| newText | Yes | Replacement content in markdown format (default) or Scrapbox syntax (when format is 'scrapbox'). May contain multiple lines separated by newline characters. | |
| matchAll | No | If true, replace every occurrence of the target (a single line or a contiguous block). Block matches are non-overlapping. Defaults to false (replace only the first match). | |
| pageTitle | Yes | Title of the page to modify | |
| projectName | No | Target project name. If not specified, defaults to 'my-cosense-project'. | |
| targetLineText | Yes | Exact text of the line(s) to replace. Matching is case-sensitive and requires full-line exact matches. If it contains newline characters, the consecutive lines are matched as a contiguous block and replaced as a whole. |