packages/kilo-docs/pages/automate/tools/list-code-definition-names.md
The list_code_definition_names tool provides a structural overview of your codebase by listing code definitions from source files at the top level of a specified directory. It helps Kilo Code understand code architecture by displaying line numbers and definition snippets.
The tool accepts these parameters:
path (required): The path of the directory to list top level source code definitions for, relative to the current working directoryThis tool scans source code files at the top level of a specified directory and extracts code definitions like classes, functions, and interfaces. It displays the line numbers and actual code for each definition, providing a quick way to map the important components of your codebase.
read_file for deeper analysisWhen the list_code_definition_names tool is invoked, it follows this process:
path parameterThe output shows file paths followed by line numbers and the actual source code of each definition. For example:
src/utils.js:
0--0 | export class HttpClient {
5--5 | formatDate() {
10--10 | function parseConfig(data) {
src/models/User.js:
0--0 | interface UserProfile {
10--10 | export class User {
20--20 | function createUser(data) {
Each line displays:
This output format helps you quickly see both where definitions are located in the file and their implementation details.
Listing code definitions in the current directory:
<list_code_definition_names>
<path>.</path>
</list_code_definition_names>
Examining a specific module's structure:
<list_code_definition_names>
<path>src/components</path>
</list_code_definition_names>
Exploring a utility library:
<list_code_definition_names>
<path>lib/utils</path>
</list_code_definition_names>