Skip to content

code_type

code_type retrieves the full definition of a TypeScript type, interface, or enum by name. Use it to understand a type’s structure without reading the file that declares it.

code_type(name="UserDTO")
code_type(name="ApiResponse")
code_type(name="OrderStatus")
ParameterTypeDefaultDescription
namestringrequiredType, interface, or enum name
interface UserDTO {
id: string;
email: string;
name: string;
role: 'admin' | 'user' | 'guest';
createdAt: Date;
metadata?: Record<string, unknown>;
}
  • Understand the shape of a DTO or response type before writing code
  • Debug a type mismatch — see exactly what fields are available
  • Check if an interface has optional fields that might cause null errors
  • Navigate inherited or extended types

To find every place a type is used across the codebase:

code_type_usages(name="UserDTO", usage_kind="all")