Skip to content

Request Normalizer

The normalizer is an internal layer ported from mcp-filesystem-go-ultra. It runs before every tool handler and fixes common parameter issues without adding any new tools.

LLM clients (Claude Desktop, etc.) sometimes send parameters with slightly wrong names, wrong types, or inconsistent JSON encoding. Instead of returning errors, the normalizer silently corrects these before the handler sees them.

50+ rules map common parameter name variants to the canonical name.

CanonicalAccepted aliases
pathfilepath, file_path, filename, file
old_textold_str, oldText, old_string, search
new_textnew_str, newText, new_string, replace
sourcesrc, from, source_path
destinationdest, dst, to, target, destination_path
contenttext, data, body
patternquery, search, regex
typeaction, operation, op
recursiverecurse
include_contentsearch_content, content_search
file_typesextensions, ext, filetypes
chunk_indexindex, chunk_number
total_chunkschunks, num_chunks, total
chunk_sizesize, bytes
create_backupbackup
follow_symlinkssymlinks, follow_links
exclude_patternsexclude, ignore

String values are converted to the expected Go type:

FromToExample
"true", "false"bool"true"true
"yes", "no"bool"yes"true
"1", "0" (for booleans)bool"1"true
Numeric stringsfloat64"3"3.0

Array parameters accept either native JSON arrays or JSON-encoded strings:

// Both work:
{ "paths": ["/a.txt", "/b.txt"] }
{ "paths": "[\"/a.txt\", \"/b.txt\"]" }

Claude Desktop sometimes sends \n as two literal characters (\ + n) instead of a real newline. The normalizer detects and fixes this in old_text and new_text parameters.

If edit_file is called where new_text is already present in the file and old_text is absent, the edit is skipped gracefully instead of returning an error. This prevents retry loops.

When edit_file can’t find old_text in the file, it returns 0 replacements with a message instead of failing. The caller is told to re-read the file for current content.

batch_operations accepts multiple field names for the same concept:

ConceptAccepted fields
Sourcefrom, source, src, path, file
Destinationto, destination, dest, dst, target
Operationtype, action

Type aliases: cpcopy, rm / removedelete.