get_text_context
This commit is contained in:
@@ -21,6 +21,7 @@ from .read_metadata import handle as read_png_metadata_handler
|
||||
from .contact_sheet import handle as contact_sheet_handler
|
||||
from .list_directory import handle as list_directory_details_handler
|
||||
from .preview_image import handle as preview_image_handler
|
||||
from .get_text_context import handle as get_text_context_handler
|
||||
|
||||
# Central registry of all available tools
|
||||
TOOL_REGISTRY = [
|
||||
@@ -87,4 +88,19 @@ TOOL_REGISTRY = [
|
||||
},
|
||||
handler=preview_image_handler
|
||||
),
|
||||
Tool(
|
||||
name="get_text_context",
|
||||
description="Extracts specific sections of a file with absolute line numbers and surrounding context. This tool MUST be called immediately before edit_file to verify the exact line numbers and content of the block being replaced, preventing misalignment errors.",
|
||||
schema={
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"path": {"type": "string", "description": "Path to the file"},
|
||||
"pattern": {"type": "string", "description": "Regex pattern to search for"},
|
||||
"lines": {"type": "string", "description": "1-based indices or ranges (e.g., '10-20, 45')"},
|
||||
"context": {"type": "integer", "description": "Number of lines of context to show above and below", "default": 1},
|
||||
},
|
||||
"required": ["path"],
|
||||
},
|
||||
handler=get_text_context_handler
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user