Skip to main content
Glama

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
NameRequiredDescriptionDefault
textYes
startYes
endYes
replacementYes

Implementation Reference

  • 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:]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/agent-hanju/char-index-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server