MCPcopy Index your code
hub / github.com/codehamr/codehamr / EditFileSchema

Function EditFileSchema

internal/tools/edit.go:76–102  ·  view source on GitHub ↗

EditFileSchema is the OpenAI tool definition for edit_file. The description steers the model toward edit_file over write_file for small changes so it stops rewriting whole documents to fix a typo.

()

Source from the content-addressed store, hash-verified

74// steers the model toward edit_file over write_file for small changes so it
75// stops rewriting whole documents to fix a typo.
76func EditFileSchema() map[string]any {
77 return map[string]any{
78 "type": "function",
79 "function": map[string]any{
80 "name": EditFileName,
81 "description": "Surgically replace a single occurrence of old_string with new_string in an existing file. old_string must appear EXACTLY ONCE in the file - include enough surrounding context to make it unique. Prefer this over write_file for any change to an existing file shorter than a full rewrite: small typo fixes, single-line edits, swapping a function body. Errors (not found, ambiguous, file missing) come back as part of the result string, same as bash. A large new_string hits the same streamed-args truncation ceiling as write_file - chunk big insertions with bash heredoc appends instead.",
82 "parameters": map[string]any{
83 "type": "object",
84 "properties": map[string]any{
85 "path": map[string]any{
86 "type": "string",
87 "description": "Absolute or relative file path. Relative paths resolve against the working directory.",
88 },
89 "old_string": map[string]any{
90 "type": "string",
91 "description": "Exact substring to find. Must be non-empty and appear exactly once.",
92 },
93 "new_string": map[string]any{
94 "type": "string",
95 "description": "Replacement string. Empty deletes the match.",
96 },
97 },
98 "required": []string{"path", "old_string", "new_string"},
99 },
100 },
101 }
102}

Callers 2

buildToolsMethod · 0.92
TestEditFileSchemaShapeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestEditFileSchemaShapeFunction · 0.68