Skip to main content
Glama
worldnine

Scrapbox Cosense MCP Server

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

NameRequiredDescriptionDefault
formatNoContent format of newText. 'markdown' (default) converts Markdown to Scrapbox syntax. 'scrapbox' passes content through as-is, preserving Scrapbox-native indentation and syntax.
newTextYesReplacement content in markdown format (default) or Scrapbox syntax (when format is 'scrapbox'). May contain multiple lines separated by newline characters.
matchAllNoIf 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).
pageTitleYesTitle of the page to modify
projectNameNoTarget project name. If not specified, defaults to 'my-cosense-project'.
targetLineTextYesExact 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.10.1

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does disclose meaningful traits: exact/contiguous matching rules, failure behavior ('returns an error if no match is found'), required credentials (COSENSE_MCP_PAT or COSENSE_SID) and the default project fallback. It stops short of saying the replaced text is permanently overwritten or how history/reversibility works, which matters for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the action and matching rule, then layers defaults, failure mode and auth. Every sentence carries information, though the matchAll sentence partly duplicates the schema and the description runs slightly long for a 6-parameter tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers matching semantics, matching failure, auth requirements and defaults, which is substantial for a mutation tool with no annotations. With no output schema present, it could have said what a successful call returns, leaving one modest gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds value beyond the schema by documenting the default projectName ('my-cosense-project') and restating matchAll's default and non-overlap rule in prose. The format parameter and its markdown-vs-scrapbox tradeoff are left entirely to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Replace one or more lines in a Scrapbox page') and pins down the matching semantics (exact text, block matching via newlines). An agent can immediately distinguish it from sibling insert_lines and delete_lines because replacement-in-place is named explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives clear operating context: default single-match behavior, matchAll for every non-overlapping occurrence, and an error when no match exists. It never names the sibling alternatives (insert_lines, delete_lines) or states when replacement is preferable to them, so routing is inferred rather than directed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.