replace_range
Replace specific character ranges in text by providing exact start and end positions with new content for precise string manipulation.
Instructions
Replace characters in range [start, end) with new text.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| start | Yes | ||
| end | Yes | ||
| replacement | Yes |
Implementation Reference
- char_index_mcp/server.py:173-181 (handler)The main handler function for the 'replace_range' tool. It performs string replacement in the specified range [start, end) using Python slicing. The @mcp.tool() decorator registers it with the MCP server and the Annotated types provide input schema validation.@mcp.tool() def replace_range( text: Annotated[str, "Original text"], start: Annotated[int, "Starting index (inclusive)"], end: Annotated[int, "Ending index (exclusive)"], replacement: Annotated[str, "Text to replace with"] ) -> str: """Replace characters in range [start, end) with new text.""" return text[:start] + replacement + text[end:]