Skip to content
cd /languages
  • Modern JVM
  • Programming
  • AST and symbol support

Kotlin Support in Maguyva: Code Graphs for Android and JVM

Maguyva parses Kotlin with AST, symbol, and graph support, so AI agents can follow classes, extension functions, and coroutines across Android and JVM code.

Where Kotlin trips up shallow AI tools

Kotlin is concise because it hides wiring. apply, let, also, run, and with change what this and it mean. Extension functions attach behaviour to types defined elsewhere. Coroutines move work across launch, async, and withContext. An agent that reads one file at a time sees the calls but not the receivers behind them.

Maguyva resolves more of that structure at index time, so an agent can ask who calls a function and get the real answer.

What Maguyva extracts in Kotlin

Maguyva covers .kt and .kts. Functions, classes, objects, and companion objects are extracted, and function signatures record extension receivers, parameter names, defaults, and vararg parameters.

Call relationships keep class-qualified names, so OrderRepository.save stays distinct from another save. Receiver typing follows this inside apply and run, it inside let and also, and the argument of with, so calls inside scope functions resolve to the right type. Coroutine builders and Flow operators (launch, async, withContext, coroutineScope, supervisorScope, flow, emit, delay, Channel) are kept in the graph on purpose.

The graph also records inheritance, interface implementation, overrides, instantiation, annotations, type references, reads and writes, and exception throw and catch edges.

Example agent prompts

  • “Who calls CheckoutUseCase.invoke, and from which view models?” (find_symbol, then dependency_search incoming)
  • “Trace the sync flow from SyncWorker to the network client.” (get_task_context)
  • “Which classes implement PaymentGateway?” (dependency_search)

Known limits

  • About 250 Kotlin standard-library and platform calls are filtered from relationships, so helpers such as listOf, map, filter, and println are not graph edges. Use text_pattern_search for them.

Next steps

Connect a repository with the quickstart, then check the support matrix on the compatibility page. For mixed codebases, read the Java guide too.

Best fit

  • > Android teams with large multi-module apps where view models, repositories, and use cases call each other across modules.
  • > Server-side Kotlin and Kotlin/JVM services that mix Kotlin with older Java code.
  • > Gradle builds written in Kotlin script (`.kts`) that agents need to read alongside application code.

Agent workflows

  • > Find every caller of a repository or use-case class before changing its API.
  • > Trace a coroutine flow from a view model `launch` through `withContext` into the data layer.
  • > Map which classes implement an interface or override a base method before a refactor.

Engine details

  • > Kotlin support covers `.kt` and `.kts`. Signatures record extension receivers, parameter names, defaults, and `vararg` parameters.
  • > Receiver typing follows `this` in `apply` and `run`, `it` in `let` and `also`, and the argument of `with`, and calls keep class-qualified names.
  • > Coroutine builders and Flow operators such as `launch`, `withContext`, and `flow` stay in the graph, while about 250 standard-library calls are filtered.

Useful MCP entry points

  • find_symbol

    Use it for a class, use case, or extension function when you need the definition and references.

  • dependency_search

    Use incoming traversal on a repository or interface to see callers and implementers before an API change.

  • get_task_context

    Use it for prompts like “trace the sync flow from `SyncWorker` to the network client.”