codemap_get_symbols
Get all symbols (functions, classes, interfaces, etc.) in a file. Supports symbol targeting (relativePath$symbolName) to get nested symbols — e.g. passing a class name returns only its methods, excluding top-level file symbols.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
target | string | ✅ Required | Relative path to the file, or symbol reference (relativePath$symbolName) to get nested symbols within that class or interface |
kind | string | ❌ Optional | Filter results by symbol kind: function|class|interface|const|type|enum|variable|method|property |
Usage Examples
MCP Usage (for AI Agents like Claude)
json
{
"name": "codemap_get_symbols",
"arguments": {
"target": "src/utils/helper.ts"
}
}Example Output
JSON Response
json
{
"success": true,
"data": {
"file": "src/utils/helpers.ts",
"symbols": [
{
"name": "formatDate",
"kind": "function",
"line": 3
},
{
"name": "parseJSON",
"kind": "function",
"line": 10
},
{
"name": "Config",
"kind": "interface",
"line": 20
}
],
"symbolCount": 3
}
}When to Use This Tool
-
Use
- List all exports in a module
- Find all functions or classes in a file
- Generate API documentation
- Analyze code structure programmatically
codemap_get_symbols when you need to:
Common Patterns
Symbol Inventory
API Documentation
1. Get all symbols
2. Group by kind
3. Generate reportAPI Documentation
1. Get symbols with kind=function
2. For each: read symbol details
3. Generate docsPro Tips
- Use kind filter for focused results: Specify kind when you only need specific symbol types
- Combine with read for details: get-symbols gives you names/lines, use read to get implementation
- Check line numbers: Use line numbers to navigate directly to symbol definitions
Best Practices
- Filter by kind when possible for faster results
- Use with peek for complete file overview
- Combine with read for full symbol implementation
- Cache results for repeated analysis
Common Mistakes
❌ Mistake: Not filtering by kind when you only need specific types
✅ Instead: Use kind parameter to get only what you need
❌ Mistake: Expecting symbol implementation in results
✅ Instead: Use read tool to get actual code, get-symbols only lists names/locations
❌ Mistake: Using get-symbols when peek would suffice
✅ Instead: Use peek with symbols:true for overview including other metadata
✅ Instead: Use kind parameter to get only what you need
❌ Mistake: Expecting symbol implementation in results
✅ Instead: Use read tool to get actual code, get-symbols only lists names/locations
❌ Mistake: Using get-symbols when peek would suffice
✅ Instead: Use peek with symbols:true for overview including other metadata