You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"or_support":"Use structured any_terms:[...] for OR semantics. all_terms are ANDed.",
86
-
"wildcards":"Use path/file as glob-like filters. Plain terms are literal term matches.",
87
-
"regex":"Use regex field to enable regex content matching.",
88
-
"path_search_behavior":"path_search requires a non-empty query and is for fuzzy path matching only.",
89
-
"file_list_behavior":"file_list enumerates directories and files with optional recursive depth and limit.",
82
+
let payload = ApiResponse::success(mcp_docs_payload());
83
+
(StatusCode::OK,Json(payload))
84
+
}
85
+
86
+
fnmcp_docs_payload() -> Value{
87
+
json!({
88
+
"search_payload":{
89
+
"semantics":"search accepts structured JSON fields only. Do not send a free-form query string.",
90
+
"or_support":"Use any_terms:[...] for OR semantics. all_terms are ANDed.",
91
+
"wildcards":"Use path/file as glob-like filters. all_terms and any_terms are literal terms, not wildcard patterns.",
92
+
"regex":"Use the regex field for content regex matching. Provide only the pattern string and JSON-escape backslashes.",
93
+
"path_search_behavior":"path_search requires a non-empty plain fuzzy query and is for fuzzy path matching only.",
94
+
"file_list_behavior":"file_list enumerates directories and files with optional recursive depth and limit. Use path as a directory prefix, not a search query.",
90
95
"file_content_behavior":"file_content supports optional start_line/end_line (1-based, inclusive) to return snippets instead of full files.",
91
96
"recency_workflow":"For recent or older change questions: repositories -> repo_branches -> search by branch and compare indexed_at or is_live.",
92
97
"search_fields":[
93
-
"repo: string",
94
-
"branch: string",
95
-
"lang: string",
96
-
"path: glob-like string",
97
-
"file: glob-like string",
98
-
"regex: string",
98
+
"repo: exact repository key from repositories",
99
+
"branch: exact branch name from repo_branches",
100
+
"lang: language filter",
101
+
"path: glob-like path filter",
102
+
"file: glob-like filename/path filter",
103
+
"regex: regex pattern string (JSON-escaped)",
99
104
"case: yes|no|auto",
100
105
"historical: boolean",
101
106
"all_terms: string[] (AND)",
102
107
"any_terms: string[] (OR)"
103
108
],
109
+
"escaping":[
110
+
"Do not prefix field values with repo:, path:, file:, or regex:.",
111
+
"Regex patterns are JSON strings, so escape backslashes. Example: \"\\\\bQueryParser\\\\(\".",
112
+
"If a JSON string contains double quotes, escape them as \\\"."
113
+
],
104
114
"troubleshooting":[
105
-
"No results with repo filter: call repositories and use exact repo key.",
106
-
"No branch results: call repo_branches and use exact branch name.",
115
+
"No results with repo filter: call repositories and use the exact repo key.",
116
+
"No branch results: call repo_branches and use the exact branch name.",
107
117
"Need OR behavior: place alternatives in any_terms:[\"termA\",\"termB\"].",
108
-
"Need regex matching: use regex:<pattern> instead of wildcard plain terms.",
109
-
"Need directory listing: use file_list instead of path_search with empty query."
118
+
"Need regex matching: set the regex field instead of using wildcard plain terms.",
119
+
"Need directory listing: use file_list. Need fuzzy path lookup: use path_search."
110
120
]
111
121
},
112
122
"cookbook":[
113
123
"1) repositories(limit=20) to discover repo keys",
114
124
"2) repo_branches(repo) to discover branch names and freshness",
115
125
"3) search({repo, branch, all_terms:[\"term\"]}) for scoped search",
116
126
"4) search({repo, branch, historical:true, all_terms:[\"term\"]}) for older snapshots",
117
-
"5) search({repo, regex:\"pattern\"}) for regex matching",
118
-
"6) file_list(repo, branch, path, depth, limit) for enumeration",
119
-
"7) path_search(repo, branch, query) for fuzzy path lookup",
120
-
"8) file_content(repo, branch, path, start_line?, end_line?) for raw source text or snippets",
127
+
"5) search({repo, regex:\"\\\\bQueryParser\\\\(\"}) for regex matching",
128
+
"6) file_list({repo, branch, path:\"src/mcp\", depth:2}) for directory enumeration",
129
+
"7) path_search({repo, branch, query:\"mcp serv\"}) for fuzzy path lookup",
130
+
"8) file_content({repo, branch, path, start_line?, end_line?}) for raw source text or snippets",
121
131
"9) For large files, prefer file_content with line snippets first, then expand only if needed",
122
-
"10) symbol_insights(params) for definitions and references",
132
+
"10) symbol_insights({params:{...}}) for definitions and references",
123
133
"11) OR behavior: search({repo, any_terms:[\"termA\",\"termB\"], dedupe:\"repo_path_line\"})",
124
134
"12) For no results, broaden filters and retry per branch"
"instructions":"Use tools to query indexed code and symbol information. Operational flow: repositories -> repo_branches -> file_list/path_search -> file_content/search/symbol_insights. Use structured search fields: all_terms are AND semantics and any_terms are OR semantics (fanout + dedupe). For recency/version questions like 'recent change', call repo_branches first, then run search with explicit branch values and compare indexed_at/is_live metadata; add historical:true when historical snapshots should be included. Plain terms do not support wildcard matching; use regex for pattern matching. path_search requires a non-empty query and is not a directory listing endpoint; use file_list for enumeration. For large files, call file_content with start_line/end_line first to limit context size.",
202
+
"instructions":"Use tools to query indexed code and symbol information; do not fall back to local filesystem reads for indexed lookup. Operational flow: repositories -> repo_branches -> file_list/path_search -> file_content/search/symbol_insights. search accepts structured JSON fields only; do not send a free-form `query` string. Keep filter values plain: do not include prefixes like `repo:`, `path:`, or `regex:` inside field values. all_terms are AND semantics and any_terms are OR semantics (fanout + dedupe). For recency/version questions like 'recent change', call repo_branches first, then run search with explicit branch values and compare indexed_at/is_live metadata; add historical:true when historical snapshots should be included. Plain terms do not support wildcard matching; use the regex field for pattern matching. path_search requires a non-empty plain fuzzy query and is not a directory listing endpoint; use file_list for enumeration. For large files, call file_content with start_line/end_line first to limit context size.",
"description":"Search indexed source code using structured fields (not a free-form DSL string). Use all_terms for AND semantics (all terms must match). Use any_terms for OR semantics (server executes one query per term, then merges/deduplicates using dedupe). Include repo/branch filters for version-aware questions, and set historical:true for older snapshots. path/file are glob-like filters, regex is a content regex filter, and case controls case sensitivity (yes|no|auto). At least one of all_terms, any_terms, or regex is required.",
334
+
"description":"Search indexed source code using structured JSON fields only. This tool does not accept a free-form `query` string. Use all_terms for AND semantics (all terms must match). Use any_terms for OR semantics (server executes one query per term, then merges/deduplicates using dedupe). Include repo/branch filters for version-aware questions, and set historical:true for older snapshots. path/file are glob-like filters, regex is a content regex filter, and case controls case sensitivity (yes|no|auto). At least one of all_terms, any_terms, or regex is required. Do not include prefixes like repo:, path:, file:, or regex: inside field values.",
"regex":{"type":"string","description":"Content regex pattern only. Do not prefix with `regex:`. JSON-escape backslashes, for example \"\\\\bQueryParser\\\\(\"."},
"all_terms":{"type":"array","items":{"type":"string"},"description":"Literal AND terms. Example: [\"symbol\", \"resolver\"]. Do not wrap these with content:."},
347
+
"any_terms":{"type":"array","items":{"type":"string"},"maxItems":8,"description":"Literal OR alternatives. Example: [\"panic\", \"unwrap\"]."},
"description":"Read raw indexed file content (no syntax highlighting) for an exact repo/branch/path from the index. Supports optional start_line/end_line (1-based, inclusive) for snippets to reduce context usage. Use this after file_list/path_search to inspect implementation details. Includes branch freshness metadata.",
393
+
"description":"Read raw indexed file content (no syntax highlighting) for an exact repo/branch/path from the index. Supports optional start_line/end_line (1-based, inclusive) for snippets to reduce context usage. Use this after file_list/path_search to inspect implementation details; prefer exact paths returned by those tools. Includes branch freshness metadata.",
379
394
"inputSchema":{
380
395
"type":"object",
381
396
"properties":{
382
397
"repo":{"type":"string"},
383
398
"branch":{"type":"string"},
384
-
"path":{"type":"string"},
399
+
"path":{"type":"string","description":"Exact file path returned by file_list or path_search. Example: \"src/mcp/server.rs\"."},
385
400
"start_line":{"type":"integer","minimum":1,"description":"Optional 1-based inclusive start line for snippet responses."},
386
401
"end_line":{"type":"integer","minimum":1,"description":"Optional 1-based inclusive end line for snippet responses."}
"description":"Enumerate files/directories under a path for a repository+branch from the index. Supports bounded recursive traversal with depth and limit. Use this for directory listing workflows and then call file_content on specific files. Response includes truncated flag, branch freshness, and stable paths.",
412
+
"description":"Enumerate files/directories under a path for a repository+branch from the index. Supports bounded recursive traversal with depth and limit. Use this for directory listing workflows and then call file_content on specific files. `path` is a directory prefix, not a fuzzy search query. Response includes truncated flag, branch freshness, and stable paths.",
395
413
"inputSchema":{
396
414
"type":"object",
397
415
"properties":{
398
416
"repo":{"type":"string"},
399
417
"branch":{"type":"string"},
400
-
"path":{"type":"string"},
418
+
"path":{"type":"string","description":"Directory prefix to enumerate from. Example: \"src/mcp\". Do not send a fuzzy query here."},
"description":"Search file and directory paths within a repository and branch using a non-empty query (fuzzy path lookup). This is path-only matching and does not enumerate full directory contents; use file_list for enumeration and file_content for file bodies. Includes freshness metadata.",
431
+
"description":"Search file and directory paths within a repository and branch using a non-empty plain fuzzy query (fuzzy path lookup). This is path-only matching and does not enumerate full directory contents; use file_list for enumeration and file_content for file bodies. Do not send filter syntax like `path:` or glob patterns here. Includes freshness metadata.",
411
432
"inputSchema":{
412
433
"type":"object",
413
434
"properties":{
414
435
"repo":{"type":"string"},
415
436
"branch":{"type":"string"},
416
-
"query":{"type":"string"},
437
+
"query":{"type":"string","description":"Plain fuzzy text only. Example: \"mcp serv\". Do not send `path:src/mcp` or glob syntax here."},
0 commit comments