Skip to main content

Command Palette

Search for a command to run...

BDK

Prompt strings

The prompt template tag keeps multi-line strings aligned with the surrounding TypeScript while returning dedented text. Use it for tool descriptions, reminder prompts, channel context, and errors. Import it from the package root or the dedicated entrypoint:

import { prompt } from "@cursor/bdk";// or: import { prompt } from "@cursor/bdk/prompt";

Dedented strings

prompt returns one string. It removes the common leading whitespace and one newline immediately after the opening backtick.

throw new Error(prompt`  It is outside business hours (Mon-Fri 9am-5pm ET).  Use request_author_approval, or pass approval=human_request.`);

Blank lines inside the body are preserved. Relative indentation after the common prefix is preserved, so nested lists keep their shape.

When interpolating multi-line values (for example a list of services), give those lines the same indent as the prompt body so dedent stays consistent.

Line arrays

prompt.lines applies the same rules and returns string[], with one entry per line. Use it when an API accepts separate context lines:

context: prompt.lines`  Merged PR detected: ${pr.url} by ${author}.  Call plan_deploy, then follow its nextStep.`