pub fn tool_category(tool: u32, name: &str) -> Option<ToolCategory>Expand description
Map a Cursor tool to toolpath’s category ontology. tool is the
numeric id from toolFormerData.tool; name is the internal tool
name. Both are needed because Anysphere has historically renamed
tools while keeping ids stable and vice versa.
Classify a Cursor tool into ToolCategory.
The mapping covers every tool name observed in:
- the 71
aiserver.v1.<Name>Paramsprotobuf messages embedded in Cursor.app’s workbench bundle (Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js), - the 47
*ToolCalldiscriminators in the same bundle’s switch statements (UI-side aliases and control-flow markers), and - the agent-side JSONL transcript vocabulary (
Shell,Read,Write,StrReplace,Glob,Grep,Task).
Numeric ids only fire for ones we’ve observed in the wild
(TOOL_* consts in crate::types). Anysphere assigns these
at the cloud-side; the workbench bundle doesn’t expose the full
enum literally and we’d rather miss a numeric id than guess one
wrong. Tools whose id we haven’t seen still classify by name.
Tools that have no clean fit in toolpath’s category ontology
(planning/todo_*, MCP machinery, UI control flow like await /
truncated / end, reporting tools, VCS read-only queries,
screenshot/diagram/image generation) return None. Consumers
still see the name + input on the ToolInvocation.