Skip to content

code_signature

code_signature returns the first line of a symbol’s definition — the name, parameters, return type, and any decorators. It skips the entire body, making it the cheapest way to verify a function’s interface.

code_signature(name="UserService.findById")
code_signature(name="processPayment")
ParameterTypeDefaultDescription
namestringrequiredSymbol name to look up
async findById(id: string): Promise<User | null>
TaskInstead ofUse
Check what params a function takescode_get — full bodycode_signature — 1 line
Verify return type before callingRead entire filecode_signature — instant

One line versus dozens or hundreds. Use code_signature when you only need to confirm the interface, not read the implementation.

  • Confirm a function’s parameter names and types before calling it
  • Check the return type of a function referenced elsewhere
  • Get a fast overview of many functions without loading their bodies