Skip to content

Commit c50f648

Browse files
committed
better mcp guidance
1 parent 370f6fb commit c50f648

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/mcp/server.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,22 @@ async fn mcp_rpc(Json(req): Json<JsonRpcRequest>) -> Response {
199199
"name": "pointer-mcp",
200200
"version": env!("CARGO_PKG_VERSION"),
201201
},
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 query string and performs case-insensitive substring matching over paths; it is not a directory listing endpoint, so use file_list for enumeration. For large files, call file_content with start_line/end_line first to limit context size.",
202+
"instructions": r#"Use MCP tools for indexed repository inspection. Start with `repositories` to discover the exact repo key, then `repo_branches` when branch selection matters. Use `path_search` for fuzzy path lookup, `file_list` for directory enumeration, `file_content` for targeted snippet reads, `search` for structured content search, and `symbol_insights` for symbol definitions and references.
203+
204+
Tool requirements:
205+
- `search` accepts structured JSON fields only. Do not send a free-form `query` string.
206+
- Keep filter values plain. Do not include prefixes like `repo:`, `path:`, or `regex:` inside field values.
207+
- `path_search.query` is plain fuzzy text only.
208+
- `file_list.path` is a directory prefix, not a search query.
209+
- `file_content.path` must be an exact path, preferably one returned by `path_search` or `file_list`.
210+
211+
Usage guidance:
212+
- Prefer narrow, incremental reads with `file_content` using `start_line` and `end_line`.
213+
- Use `all_terms` for AND semantics, `any_terms` for OR semantics, and `regex` only for regex content matching.
214+
- If branch recency or version differences matter, call `repo_branches` first and compare explicit branch results.
215+
216+
Citation requirement:
217+
- When citing code, use the MCP server UI hyperlink format: https://{mcp_server_host}/repo/{repo}/tree/{branch|commit}/{path}#L{Line number}"#,
203218
});
204219
jsonrpc_result(req.id, result)
205220
}

0 commit comments

Comments
 (0)