---
title: "lsp"
description: "The lsp namespace — the engine's Luau API reference for lsp."
section: "API Reference"
slug: "api-lsp"
canonical: "https://origozero.ai/docs/api-lsp"
updated: "2026-09-05T23:13:46.684852551+00:00"
tags: ["api", "reference"]
---

# lsp

The `lsp` namespace — 64 functions.

## globals/lsp/check {#globals-lsp-check}

```lua
lsp.check(path: string, opts: CheckOpts?) -> DiagnosticsResult
```

Validate a single `.luau` file in the VFS and return its
diagnostics. A path the check could not read comes back as one
`lsp-check-*` error naming the path and the reason, so `errors == 0`
means a code body was read and is clean.

**Parameters**

- `path` `string` — VFS path.
- `opts` `CheckOpts` _(optional)_ — `{ severity?, limit?, context? }`.

**Returns** `DiagnosticsResult` — Array of diagnostic tables.

```lua
local diags = lsp.check("/zero/source/main.luau")
```

## globals/lsp/checkAll {#globals-lsp-checkall}

```lua
lsp.checkAll(opts: CheckAllOpts?) -> CheckAllResult
```

Validate the user's Luau scripts and return an aggregate
summary plus diagnostic list. `opts.scope = "user"` (default)
skips library mounts; `"all"` includes them. The sweep is
time-budgeted (ZERO_EXECUTE_INLINE_BUDGET_MS, ~20s by default): if
the budget elapses it returns the partial result gathered so far
with `budgetExceeded = true` rather than blocking the engine.

**Parameters**

- `opts` `CheckAllOpts` _(optional)_ — `{ scope?, severity?, limit? }`.

**Returns** `CheckAllResult` — `{ filesChecked, errors, warnings, info, hints, budgetExceeded, diagnostics }`.

## globals/lsp/checkCode {#globals-lsp-checkcode}

```lua
lsp.checkCode(source: string, opts: CheckOpts?) -> DiagnosticsResult
```

Validate inline Luau source without a backing file. Useful
for checking code before writing it to disk.

**Parameters**

- `source` `string` — Luau source.
- `opts` `CheckOpts` _(optional)_ — `{ severity?, limit?, context? }`.

**Returns** `DiagnosticsResult` — Array of diagnostic tables.

## globals/lsp/checkDirty {#globals-lsp-checkdirty}

```lua
lsp.checkDirty() -> DiagnosticsResult
```

Drain the dirty-file set populated by the hot-reload hook,
validate each, and return the combined diagnostic list.

**Returns** `DiagnosticsResult` — Array of diagnostic tables.

## globals/lsp/describe {#globals-lsp-describe}

```lua
lsp.describe(path: string, opts: DescribeOpts?) -> DocEntry?
```

Inspect a single documented entry. Returns the full doc
table (signature, args, returns, examples, level), or nil.
The path is resolved independently of which root the doc is
registered under and of separator style, so the spelling that reads
off the API surface (`renderer.texture.create`) finds the entry
registered as `globals/renderer/texture/create`. A path naming a
binding the engine registered internally answers with the entry a Luau
module publishes over it where there is one, so the signature is the
call content makes; `opts.includeInternal` answers with the internally
registered entry itself. When a path does not resolve,
`lsp.describePaths` says what the registry holds near it.

**Parameters**

- `path` `string` — Doc path (e.g. `"asset/resolve"`, `"renderer.texture.create"`).
- `opts` `DescribeOpts` _(optional)_ — Optional `{ includeInternal? }` — default prefers the published entry.

**Returns** `DocEntry?` — Full doc table or nil.

```lua
local doc = lsp.describe("renderer.texture.create")
```

## globals/lsp/describePaths {#globals-lsp-describepaths}

```lua
lsp.describePaths(path: string) -> { string }
```

List the registered doc paths related to `path`. A path that names
an entry returns every root it is registered under (the first is what
`lsp.describe` resolves to); a path that names a namespace returns the
entries registered under it. Empty when the registry holds nothing
near the path — so a lookup that returns nil can always be turned into
the list of what does exist.

**Parameters**

- `path` `string` — Doc path in any spelling (`"renderer.texture"`, `"ecs/query"`).

**Returns** `{ string }` — Array of registered doc paths, most canonical first.

```lua
for _, p in ipairs(lsp.describePaths("renderer.texture")) do print(p) end
```

## globals/lsp/describeTool {#globals-lsp-describetool}

```lua
lsp.describeTool(path: string) -> string?
```

Return the full documentation text for a code-mode tool.

**Parameters**

- `path` `string` — Tool path (e.g. `"scene/spawnLight"`).

**Returns** `string?` — Full tool docs or nil.

## globals/lsp/docsByKind {#globals-lsp-docsbykind}

```lua
lsp.docsByKind(kind: string) -> { MethodSummary }
```

List every doc whose registration kind matches `kind`.
Valid: `"binding"`, `"runtime_tool"`, `"module"`, `"component"`,
`"library"`, `"lua_export"`.

**Parameters**

- `kind` `string` — Registration kind.

**Returns** `{ MethodSummary }` — Array of doc summary tables.

## globals/lsp/getStrictMode {#globals-lsp-getstrictmode}

```lua
lsp.getStrictMode() -> StrictMode
```

Return the current strict mode.

**Returns** `StrictMode` — `"off"` | `"soft"` | `"strict"`.

## globals/lsp/isStrict {#globals-lsp-isstrict}

```lua
lsp.isStrict() -> boolean
```

Is the pre-execute LSP gate fully strict? False when off or
in soft mode.

**Returns** `boolean` — True when fully strict.

## globals/lsp/lastCheckGen {#globals-lsp-lastcheckgen}

```lua
lsp.lastCheckGen() -> number
```

Generation counter — bumped each time the cache is rebuilt.
UI polls this to know when to redraw.

**Returns** `number` — Generation number.

## globals/lsp/methods {#globals-lsp-methods}

```lua
lsp.methods(namespace: string, opts: MethodsOpts?) -> { MethodSummary } | { string }
```

List every documented method / entry under a namespace. A broad
namespace (`ui`, `renderer`) returns a large dump by default, so two
options narrow it: `opts.filter` keeps only methods whose name (or
doc path) contains the substring, case-insensitively; `opts.namesOnly`
returns a plain list of method-name strings instead of the full
per-method summary tables — much smaller, and nothing to unwrap. The
listing answers with the surface content calls: an entry registered
internally is left out where its signature spells the `__` binding or a
Luau module publishes the same member, and `opts.includeInternal` lists
every registered entry instead.

**Parameters**

- `namespace` `string` — Namespace name (e.g. `"entity"`, `"modules/Transform"`).
- `opts` `MethodsOpts` _(optional)_ — Optional `{ filter?, namesOnly?, includeInternal? }`.

**Returns** `{ MethodSummary } | { string }` — Array of method summary tables, or plain name strings when `namesOnly` is set (empty when the namespace is unknown or nothing matches the filter).

```lua
for _, name in ipairs(lsp.methods("ui", { namesOnly = true })) do print(name) end
lsp.methods("renderer", { filter = "shadow" })
```

## globals/lsp/modules {#globals-lsp-modules}

```lua
lsp.modules() -> { ModuleEntry }
```

List every Luau library module the engine currently knows
about — discovered via `--!module` headers, library scans, and
manually-recorded docs.

**Returns** `{ ModuleEntry }` — Array of module summary tables.

## globals/lsp/namespaces {#globals-lsp-namespaces}

```lua
lsp.namespaces(opts: NamespacesOpts?) -> { NamespaceEntry }
```

List the documentation namespaces reachable from Luau. By
default only namespaces exposing at least one PUBLIC method are
returned, so the list matches what you can actually call — internal
FFI plumbing (e.g. `pause`, `native_entity`), whose public surface
lives elsewhere (`engine.paused`, the `entity` proxy, …), is left
out. Pass `{ includeInternal = true }` to list every namespace,
internal ones included.

**Parameters**

- `opts` `NamespacesOpts` _(optional)_ — Optional `{ includeInternal? }` — default lists public only.

**Returns** `{ NamespaceEntry }` — Array of namespace summary tables.

```lua
for _, ns in ipairs(lsp.namespaces()) do print(ns.name) end
```

## globals/lsp/readDirectives {#globals-lsp-readdirectives}

```lua
lsp.readDirectives(source: string) -> DirectiveBlock
```

Parse the leading `--!` directive block of a Luau source
string. Used by UIs that audit which files have skip directives
and what they suppress.

**Parameters**

- `source` `string` — Luau source text.

**Returns** `DirectiveBlock` — `{ mode, codes? }`.

## globals/lsp/search {#globals-lsp-search}

```lua
lsp.search(query: string, opts: SearchOpts?) -> { MethodSummary }
```

Case-insensitive substring search across every registered
doc's path, signature, and description. Hits answer with the surface
content calls: an entry registered internally is left out where its
signature spells the `__` binding or a Luau module publishes the same
member, and `opts.includeInternal` searches every registered entry.

**Parameters**

- `query` `string` — Substring to search for.
- `opts` `SearchOpts` _(optional)_ — `{ limit? = 50, includeInternal? }`.

**Returns** `{ MethodSummary }` — Array of method summary tables.

## globals/lsp/setStrict {#globals-lsp-setstrict}

```lua
lsp.setStrict(enabled: boolean) -> boolean
```

Toggle the pre-execute LSP gate. Returns true when the change
was persisted to `.world_settings`, false when the play-mode write
lock blocked the write.

**Parameters**

- `enabled` `boolean` — True = strict, false = off.

**Returns** `boolean` — Persistence signal.

## globals/lsp/setStrictMode {#globals-lsp-setstrictmode}

```lua
lsp.setStrictMode(mode: StrictMode) -> boolean
```

Set the pre-execute strict gate's mode. Returns true when the
change was persisted to `.world_settings`, false when the
play-mode write lock blocked the write.

**Parameters**

- `mode` `StrictMode` — `"off"` | `"soft"` | `"strict"`.

**Returns** `boolean` — Persistence signal.

## globals/lsp/summary {#globals-lsp-summary}

```lua
lsp.summary() -> Summary
```

Counts only — does not re-run validation.

**Returns** `Summary` — Counts of cached diagnostics by severity.

## globals/lsp/tools {#globals-lsp-tools}

```lua
lsp.tools() -> { ToolEntry }
```

List every code-mode tool registered in the VFS under
`/zero/docs/tools/<category>/<tool>`.

**Returns** `{ ToolEntry }` — Array of tool summary tables.

## globals/lsp/typeOf {#globals-lsp-typeof}

```lua
lsp.typeOf(expr_source: string, context_path: string?) -> TypeDescriptor
```

Infer the static type of a Luau expression. When
`context_path` is given, the file is loaded and walked so the
inference env contains every local + alias in scope at its end.

**Parameters**

- `expr_source` `string` — Luau expression source (no surrounding chunk).
- `context_path` `string` _(optional)_ — VFS path whose scope should be visible.

**Returns** `TypeDescriptor` — Type descriptor table.

```lua
local td = lsp.typeOf("Transform.lookAt", "/zero/source/main.luau")
```

## modules/lsp/README {#modules-lsp-readme}

```lua
require("@builtin/modules/api/engine/lsp") -- lsp (also available as global 'lsp')
```

Embedded Luau language server — check / search / inspect Public Luau surface over the `__lsp` Internal FFI namespace.

Usage: local lsp = require("@builtin/modules/api/engine/lsp")
Also available as global: lsp

## modules/lsp/check {#modules-lsp-check}

```lua
check(path: string, opts: CheckOpts?): DiagnosticsResult
```

Validate a single `.luau` file in the VFS and return its
diagnostics. A path the check could not read comes back as one
`lsp-check-*` error naming the path and the reason, so `errors == 0`
means a code body was read and is clean.

**Parameters**

- `path` `string` — VFS path.
- `opts` `CheckOpts?` _(optional)_ — `{ severity?, limit?, context? }`.

```lua
local diags = lsp.check("/zero/source/main.luau")
```

## modules/lsp/checkAll {#modules-lsp-checkall}

```lua
checkAll(opts: CheckAllOpts?): CheckAllResult
```

Validate the user's Luau scripts and return an aggregate
summary plus diagnostic list. `opts.scope = "user"` (default)
skips library mounts; `"all"` includes them. The sweep is
time-budgeted (ZERO_EXECUTE_INLINE_BUDGET_MS, ~20s by default): if
the budget elapses it returns the partial result gathered so far
with `budgetExceeded = true` rather than blocking the engine.

**Parameters**

- `opts` `CheckAllOpts?` _(optional)_ — `{ scope?, severity?, limit? }`.

## modules/lsp/checkCode {#modules-lsp-checkcode}

```lua
checkCode(source: string, opts: CheckOpts?): DiagnosticsResult
```

Validate inline Luau source without a backing file. Useful
for checking code before writing it to disk.

**Parameters**

- `source` `string` — Luau source.
- `opts` `CheckOpts?` _(optional)_ — `{ severity?, limit?, context? }`.

## modules/lsp/checkDirty {#modules-lsp-checkdirty}

```lua
checkDirty(): DiagnosticsResult
```

Drain the dirty-file set populated by the hot-reload hook,
validate each, and return the combined diagnostic list.

## modules/lsp/describe {#modules-lsp-describe}

```lua
describe(path: string, opts: DescribeOpts?): DocEntry?
```

Inspect a single documented entry. Returns the full doc
table (signature, args, returns, examples, level), or nil.
The path is resolved independently of which root the doc is
registered under and of separator style, so the spelling that reads
off the API surface (`renderer.texture.create`) finds the entry
registered as `globals/renderer/texture/create`. A path naming a
binding the engine registered internally answers with the entry a Luau
module publishes over it where there is one, so the signature is the
call content makes; `opts.includeInternal` answers with the internally
registered entry itself. When a path does not resolve,
`lsp.describePaths` says what the registry holds near it.

**Parameters**

- `path` `string` — Doc path (e.g. `"asset/resolve"`, `"renderer.texture.create"`).
- `opts` `DescribeOpts?` _(optional)_ — Optional `{ includeInternal? }` — default prefers the published entry.

```lua
local doc = lsp.describe("renderer.texture.create")
```

## modules/lsp/describePaths {#modules-lsp-describepaths}

```lua
describePaths(path: string): { string }
```

List the registered doc paths related to `path`. A path that names
an entry returns every root it is registered under (the first is what
`lsp.describe` resolves to); a path that names a namespace returns the
entries registered under it. Empty when the registry holds nothing
near the path — so a lookup that returns nil can always be turned into
the list of what does exist.

**Parameters**

- `path` `string` — Doc path in any spelling (`"renderer.texture"`, `"ecs/query"`).

```lua
for _, p in ipairs(lsp.describePaths("renderer.texture")) do print(p) end
```

## modules/lsp/describeTool {#modules-lsp-describetool}

```lua
describeTool(path: string): string?
```

Return the full documentation text for a code-mode tool.

**Parameters**

- `path` `string` — Tool path (e.g. `"scene/spawnLight"`).

## modules/lsp/docsByKind {#modules-lsp-docsbykind}

```lua
docsByKind(kind: string): { MethodSummary }
```

List every doc whose registration kind matches `kind`.
Valid: `"binding"`, `"runtime_tool"`, `"module"`, `"component"`,
`"library"`, `"lua_export"`.

**Parameters**

- `kind` `string` — Registration kind.

## modules/lsp/getStrictMode {#modules-lsp-getstrictmode}

```lua
getStrictMode(): StrictMode
```

Return the current strict mode.

## modules/lsp/isStrict {#modules-lsp-isstrict}

```lua
isStrict(): boolean
```

Is the pre-execute LSP gate fully strict? False when off or
in soft mode.

## modules/lsp/lastCheckGen {#modules-lsp-lastcheckgen}

```lua
lastCheckGen(): number
```

Generation counter — bumped each time the cache is rebuilt.
UI polls this to know when to redraw.

## modules/lsp/methods {#modules-lsp-methods}

```lua
methods(namespace: string, opts: MethodsOpts?): { MethodSummary } | { string }
```

List every documented method / entry under a namespace. A broad
namespace (`ui`, `renderer`) returns a large dump by default, so two
options narrow it: `opts.filter` keeps only methods whose name (or
doc path) contains the substring, case-insensitively; `opts.namesOnly`
returns a plain list of method-name strings instead of the full
per-method summary tables — much smaller, and nothing to unwrap. The
listing answers with the surface content calls: an entry registered
internally is left out where its signature spells the `__` binding or a
Luau module publishes the same member, and `opts.includeInternal` lists
every registered entry instead.

**Parameters**

- `namespace` `string` — Namespace name (e.g. `"entity"`, `"modules/Transform"`).
- `opts` `MethodsOpts?` _(optional)_ — Optional `{ filter?, namesOnly?, includeInternal? }`.

```lua
for _, name in ipairs(lsp.methods("ui", { namesOnly = true })) do print(name) end
lsp.methods("renderer", { filter = "shadow" })
```

## modules/lsp/modules {#modules-lsp-modules}

```lua
modules(): { ModuleEntry }
```

List every Luau library module the engine currently knows
about — discovered via `--!module` headers, library scans, and
manually-recorded docs.

## modules/lsp/namespaces {#modules-lsp-namespaces}

```lua
namespaces(opts: NamespacesOpts?): { NamespaceEntry }
```

List the documentation namespaces reachable from Luau. By
default only namespaces exposing at least one PUBLIC method are
returned, so the list matches what you can actually call — internal
FFI plumbing (e.g. `pause`, `native_entity`), whose public surface
lives elsewhere (`engine.paused`, the `entity` proxy, …), is left
out. Pass `{ includeInternal = true }` to list every namespace,
internal ones included.

**Parameters**

- `opts` `NamespacesOpts?` _(optional)_ — Optional `{ includeInternal? }` — default lists public only.

```lua
for _, ns in ipairs(lsp.namespaces()) do print(ns.name) end
```

## modules/lsp/readDirectives {#modules-lsp-readdirectives}

```lua
readDirectives(source: string): DirectiveBlock
```

Parse the leading `--!` directive block of a Luau source
string. Used by UIs that audit which files have skip directives
and what they suppress.

**Parameters**

- `source` `string` — Luau source text.

## modules/lsp/search {#modules-lsp-search}

```lua
search(query: string, opts: SearchOpts?): { MethodSummary }
```

Case-insensitive substring search across every registered
doc's path, signature, and description. Hits answer with the surface
content calls: an entry registered internally is left out where its
signature spells the `__` binding or a Luau module publishes the same
member, and `opts.includeInternal` searches every registered entry.

**Parameters**

- `query` `string` — Substring to search for.
- `opts` `SearchOpts?` _(optional)_ — `{ limit? = 50, includeInternal? }`.

## modules/lsp/setStrict {#modules-lsp-setstrict}

```lua
setStrict(enabled: boolean): boolean
```

Toggle the pre-execute LSP gate. Returns true when the change
was persisted to `.world_settings`, false when the play-mode write
lock blocked the write.

**Parameters**

- `enabled` `boolean` — True = strict, false = off.

## modules/lsp/setStrictMode {#modules-lsp-setstrictmode}

```lua
setStrictMode(mode: StrictMode): boolean
```

Set the pre-execute strict gate's mode. Returns true when the
change was persisted to `.world_settings`, false when the
play-mode write lock blocked the write.

**Parameters**

- `mode` `StrictMode` — `"off"` | `"soft"` | `"strict"`.

## modules/lsp/summary {#modules-lsp-summary}

```lua
summary(): Summary
```

Counts only — does not re-run validation.

## modules/lsp/tools {#modules-lsp-tools}

```lua
tools(): { ToolEntry }
```

List every code-mode tool registered in the VFS under
`/zero/docs/tools/<category>/<tool>`.

## modules/lsp/typeOf {#modules-lsp-typeof}

```lua
typeOf(expr_source: string, context_path: string?): TypeDescriptor
```

Infer the static type of a Luau expression. When
`context_path` is given, the file is loaded and walked so the
inference env contains every local + alias in scope at its end.

**Parameters**

- `expr_source` `string` — Luau expression source (no surrounding chunk).
- `context_path` `string?` _(optional)_ — VFS path whose scope should be visible.

```lua
local td = lsp.typeOf("Transform.lookAt", "/zero/source/main.luau")
```

## typed/builtin//modules/api/engine/lsp/lsp/check {#typed-builtin-modules-api-engine-lsp-lsp-check}

```lua
lsp.check(path: string, opts: CheckOpts?) -> DiagnosticsResult
```

Validate a single `.luau` file in the VFS and return its
diagnostics. A path the check could not read comes back as one
`lsp-check-*` error naming the path and the reason, so `errors == 0`
means a code body was read and is clean.

**Parameters**

- `path` `string` — VFS path.
- `opts` `CheckOpts` _(optional)_ — `{ severity?, limit?, context? }`.

**Returns** `DiagnosticsResult` — Array of diagnostic tables.

```lua
local diags = lsp.check("/zero/source/main.luau")
```

## typed/builtin//modules/api/engine/lsp/lsp/checkAll {#typed-builtin-modules-api-engine-lsp-lsp-checkall}

```lua
lsp.checkAll(opts: CheckAllOpts?) -> CheckAllResult
```

Validate the user's Luau scripts and return an aggregate
summary plus diagnostic list. `opts.scope = "user"` (default)
skips library mounts; `"all"` includes them. The sweep is
time-budgeted (ZERO_EXECUTE_INLINE_BUDGET_MS, ~20s by default): if
the budget elapses it returns the partial result gathered so far
with `budgetExceeded = true` rather than blocking the engine.

**Parameters**

- `opts` `CheckAllOpts` _(optional)_ — `{ scope?, severity?, limit? }`.

**Returns** `CheckAllResult` — `{ filesChecked, errors, warnings, info, hints, budgetExceeded, diagnostics }`.

## typed/builtin//modules/api/engine/lsp/lsp/checkCode {#typed-builtin-modules-api-engine-lsp-lsp-checkcode}

```lua
lsp.checkCode(source: string, opts: CheckOpts?) -> DiagnosticsResult
```

Validate inline Luau source without a backing file. Useful
for checking code before writing it to disk.

**Parameters**

- `source` `string` — Luau source.
- `opts` `CheckOpts` _(optional)_ — `{ severity?, limit?, context? }`.

**Returns** `DiagnosticsResult` — Array of diagnostic tables.

## typed/builtin//modules/api/engine/lsp/lsp/checkDirty {#typed-builtin-modules-api-engine-lsp-lsp-checkdirty}

```lua
lsp.checkDirty() -> DiagnosticsResult
```

Drain the dirty-file set populated by the hot-reload hook,
validate each, and return the combined diagnostic list.

**Returns** `DiagnosticsResult` — Array of diagnostic tables.

## typed/builtin//modules/api/engine/lsp/lsp/describe {#typed-builtin-modules-api-engine-lsp-lsp-describe}

```lua
lsp.describe(path: string, opts: DescribeOpts?) -> DocEntry?
```

Inspect a single documented entry. Returns the full doc
table (signature, args, returns, examples, level), or nil.
The path is resolved independently of which root the doc is
registered under and of separator style, so the spelling that reads
off the API surface (`renderer.texture.create`) finds the entry
registered as `globals/renderer/texture/create`. A path naming a
binding the engine registered internally answers with the entry a Luau
module publishes over it where there is one, so the signature is the
call content makes; `opts.includeInternal` answers with the internally
registered entry itself. When a path does not resolve,
`lsp.describePaths` says what the registry holds near it.

**Parameters**

- `path` `string` — Doc path (e.g. `"asset/resolve"`, `"renderer.texture.create"`).
- `opts` `DescribeOpts` _(optional)_ — Optional `{ includeInternal? }` — default prefers the published entry.

**Returns** `DocEntry?` — Full doc table or nil.

```lua
local doc = lsp.describe("renderer.texture.create")
```

## typed/builtin//modules/api/engine/lsp/lsp/describePaths {#typed-builtin-modules-api-engine-lsp-lsp-describepaths}

```lua
lsp.describePaths(path: string) -> { string }
```

List the registered doc paths related to `path`. A path that names
an entry returns every root it is registered under (the first is what
`lsp.describe` resolves to); a path that names a namespace returns the
entries registered under it. Empty when the registry holds nothing
near the path — so a lookup that returns nil can always be turned into
the list of what does exist.

**Parameters**

- `path` `string` — Doc path in any spelling (`"renderer.texture"`, `"ecs/query"`).

**Returns** `{ string }` — Array of registered doc paths, most canonical first.

```lua
for _, p in ipairs(lsp.describePaths("renderer.texture")) do print(p) end
```

## typed/builtin//modules/api/engine/lsp/lsp/describeTool {#typed-builtin-modules-api-engine-lsp-lsp-describetool}

```lua
lsp.describeTool(path: string) -> string?
```

Return the full documentation text for a code-mode tool.

**Parameters**

- `path` `string` — Tool path (e.g. `"scene/spawnLight"`).

**Returns** `string?` — Full tool docs or nil.

## typed/builtin//modules/api/engine/lsp/lsp/docsByKind {#typed-builtin-modules-api-engine-lsp-lsp-docsbykind}

```lua
lsp.docsByKind(kind: string) -> { MethodSummary }
```

List every doc whose registration kind matches `kind`.
Valid: `"binding"`, `"runtime_tool"`, `"module"`, `"component"`,
`"library"`, `"lua_export"`.

**Parameters**

- `kind` `string` — Registration kind.

**Returns** `{ MethodSummary }` — Array of doc summary tables.

## typed/builtin//modules/api/engine/lsp/lsp/getStrictMode {#typed-builtin-modules-api-engine-lsp-lsp-getstrictmode}

```lua
lsp.getStrictMode() -> StrictMode
```

Return the current strict mode.

**Returns** `StrictMode` — `"off"` | `"soft"` | `"strict"`.

## typed/builtin//modules/api/engine/lsp/lsp/isStrict {#typed-builtin-modules-api-engine-lsp-lsp-isstrict}

```lua
lsp.isStrict() -> boolean
```

Is the pre-execute LSP gate fully strict? False when off or
in soft mode.

**Returns** `boolean` — True when fully strict.

## typed/builtin//modules/api/engine/lsp/lsp/lastCheckGen {#typed-builtin-modules-api-engine-lsp-lsp-lastcheckgen}

```lua
lsp.lastCheckGen() -> number
```

Generation counter — bumped each time the cache is rebuilt.
UI polls this to know when to redraw.

**Returns** `number` — Generation number.

## typed/builtin//modules/api/engine/lsp/lsp/methods {#typed-builtin-modules-api-engine-lsp-lsp-methods}

```lua
lsp.methods(namespace: string, opts: MethodsOpts?) -> { MethodSummary } | { string }
```

List every documented method / entry under a namespace. A broad
namespace (`ui`, `renderer`) returns a large dump by default, so two
options narrow it: `opts.filter` keeps only methods whose name (or
doc path) contains the substring, case-insensitively; `opts.namesOnly`
returns a plain list of method-name strings instead of the full
per-method summary tables — much smaller, and nothing to unwrap. The
listing answers with the surface content calls: an entry registered
internally is left out where its signature spells the `__` binding or a
Luau module publishes the same member, and `opts.includeInternal` lists
every registered entry instead.

**Parameters**

- `namespace` `string` — Namespace name (e.g. `"entity"`, `"modules/Transform"`).
- `opts` `MethodsOpts` _(optional)_ — Optional `{ filter?, namesOnly?, includeInternal? }`.

**Returns** `{ MethodSummary } | { string }` — Array of method summary tables, or plain name strings when `namesOnly` is set (empty when the namespace is unknown or nothing matches the filter).

```lua
for _, name in ipairs(lsp.methods("ui", { namesOnly = true })) do print(name) end
lsp.methods("renderer", { filter = "shadow" })
```

## typed/builtin//modules/api/engine/lsp/lsp/modules {#typed-builtin-modules-api-engine-lsp-lsp-modules}

```lua
lsp.modules() -> { ModuleEntry }
```

List every Luau library module the engine currently knows
about — discovered via `--!module` headers, library scans, and
manually-recorded docs.

## typed/builtin//modules/api/engine/lsp/lsp/namespaces {#typed-builtin-modules-api-engine-lsp-lsp-namespaces}

```lua
lsp.namespaces(opts: NamespacesOpts?) -> { NamespaceEntry }
```

List the documentation namespaces reachable from Luau. By
default only namespaces exposing at least one PUBLIC method are
returned, so the list matches what you can actually call — internal
FFI plumbing (e.g. `pause`, `native_entity`), whose public surface
lives elsewhere (`engine.paused`, the `entity` proxy, …), is left
out. Pass `{ includeInternal = true }` to list every namespace,
internal ones included.

**Parameters**

- `opts` `NamespacesOpts` _(optional)_ — Optional `{ includeInternal? }` — default lists public only.

**Returns** `{ NamespaceEntry }` — Array of namespace summary tables.

```lua
for _, ns in ipairs(lsp.namespaces()) do print(ns.name) end
```

## typed/builtin//modules/api/engine/lsp/lsp/readDirectives {#typed-builtin-modules-api-engine-lsp-lsp-readdirectives}

```lua
lsp.readDirectives(source: string) -> DirectiveBlock
```

Parse the leading `--!` directive block of a Luau source
string. Used by UIs that audit which files have skip directives
and what they suppress.

**Parameters**

- `source` `string` — Luau source text.

**Returns** `DirectiveBlock` — `{ mode, codes? }`.

## typed/builtin//modules/api/engine/lsp/lsp/search {#typed-builtin-modules-api-engine-lsp-lsp-search}

```lua
lsp.search(query: string, opts: SearchOpts?) -> { MethodSummary }
```

Case-insensitive substring search across every registered
doc's path, signature, and description. Hits answer with the surface
content calls: an entry registered internally is left out where its
signature spells the `__` binding or a Luau module publishes the same
member, and `opts.includeInternal` searches every registered entry.

**Parameters**

- `query` `string` — Substring to search for.
- `opts` `SearchOpts` _(optional)_ — `{ limit? = 50, includeInternal? }`.

**Returns** `{ MethodSummary }` — Array of method summary tables.

## typed/builtin//modules/api/engine/lsp/lsp/setStrict {#typed-builtin-modules-api-engine-lsp-lsp-setstrict}

```lua
lsp.setStrict(enabled: boolean) -> boolean
```

Toggle the pre-execute LSP gate. Returns true when the change
was persisted to `.world_settings`, false when the play-mode write
lock blocked the write.

**Parameters**

- `enabled` `boolean` — True = strict, false = off.

**Returns** `boolean` — Persistence signal.

## typed/builtin//modules/api/engine/lsp/lsp/setStrictMode {#typed-builtin-modules-api-engine-lsp-lsp-setstrictmode}

```lua
lsp.setStrictMode(mode: StrictMode) -> boolean
```

Set the pre-execute strict gate's mode. Returns true when the
change was persisted to `.world_settings`, false when the
play-mode write lock blocked the write.

**Parameters**

- `mode` `StrictMode` — `"off"` | `"soft"` | `"strict"`.

**Returns** `boolean` — Persistence signal.

## typed/builtin//modules/api/engine/lsp/lsp/summary {#typed-builtin-modules-api-engine-lsp-lsp-summary}

```lua
lsp.summary() -> Summary
```

Counts only — does not re-run validation.

**Returns** `Summary` — Counts of cached diagnostics by severity.

## typed/builtin//modules/api/engine/lsp/lsp/tools {#typed-builtin-modules-api-engine-lsp-lsp-tools}

```lua
lsp.tools() -> { ToolEntry }
```

List every code-mode tool registered in the VFS under
`/zero/docs/tools/<category>/<tool>`.

## typed/builtin//modules/api/engine/lsp/lsp/typeOf {#typed-builtin-modules-api-engine-lsp-lsp-typeof}

```lua
lsp.typeOf(expr_source: string, context_path: string?) -> TypeDescriptor
```

Infer the static type of a Luau expression. When
`context_path` is given, the file is loaded and walked so the
inference env contains every local + alias in scope at its end.

**Parameters**

- `expr_source` `string` — Luau expression source (no surrounding chunk).
- `context_path` `string` _(optional)_ — VFS path whose scope should be visible.

**Returns** `TypeDescriptor` — Type descriptor table.

```lua
local td = lsp.typeOf("Transform.lookAt", "/zero/source/main.luau")
```
