Skip to main content
POST
Get Definition

Overview

Find where a Python symbol (function, class, variable, etc.) is defined. This provides the “Go to Definition” functionality that lets you navigate to the source code of any symbol.

Request

string
required
File URI (e.g., file:///workspace/main.py)
number
required
Line number (0-indexed)
number
required
Character position (0-indexed)

Response

array
Array of definition locations (usually just one)

Example Request

Example Response

Use Cases

Find Class Definition

Jump to Import Source

Find Variable Declaration

Multiple Definitions

Some symbols may have multiple definitions (e.g., overloaded functions, re-exports):
When multiple definitions exist, the first one is typically the primary definition.

Definition Types

Performance Tips

Cache Definition Locations: Store frequently accessed definitions to reduce lookups
Batch Requests: If checking multiple symbols, batch them in one request
Workspace Indexing: Initial workspace load may take time; subsequent lookups are fast

Error Responses

Rate Limits

Get References

Find all places where a symbol is used

Get Hover

See documentation without jumping

Get Type Definition

Go to type definition instead of value

Rename Symbol

Rename symbol across entire project