Skip to content

usage_counts

MCP tools › Code insight and refactoring

Usage counts of a workspace file's declarations from its language server, as the editor shows them inline: name, kind, 0-based line, count of distinct using places and source. Counts types, methods, functions, constructors, fields, properties and enum members, not locals. Java, JavaScript, TypeScript and Kotlin also give inheritors (subtypes, overriding members) and list unused declarations with count 0; elsewhere unused ones are left out. At most 200 declarations per call; from_line/to_line limit the range. complete is false when the timeout ended first.

Its results carry text from files, language_server: the client is told to treat that as data, never as instructions.

Capabilitycode.usage_counts
AreaCode insight and refactoring
Accessreads only
Reachesprocess
Rightsnone
Dry runnone

Arguments

ArgumentTypeDescription
pathrequiredstringWorkspace-relative file path.
timeout_secondsintegerSeconds the counting may take (default 60, at most 120); what is counted by then is answered with complete false.minimum 0
from_lineintegerCount only the declarations from this 0-based line on (with or without to_line).minimum 0
to_lineintegerCount only the declarations up to this 0-based line, inclusive.minimum 0

Call it from a shell

ferris-idea call runs one tool with the rights and safe mode of ferris-idea mcp. Replace the folder and the placeholder values.

Terminal window
ferris-idea call ~/my-project usage_counts '{"path":"<string>"}'
Input schema as JSON
{
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"description": "Workspace-relative file path.",
"type": "string"
},
"timeout_seconds": {
"description": "Seconds the counting may take (default 60, at most 120); what is counted by then is\nanswered with `complete` false.",
"type": [
"integer",
"null"
],
"minimum": 0
},
"from_line": {
"description": "Count only the declarations from this 0-based line on (with or without `to_line`).",
"type": [
"integer",
"null"
],
"minimum": 0
},
"to_line": {
"description": "Count only the declarations up to this 0-based line, inclusive.",
"type": [
"integer",
"null"
],
"minimum": 0
}
}
}