Deco
decocms

user_ask

Ask the user a question to gather input or clarification

Overview

Asks the user a question to gather input or clarification. Supports text input, multiple choice, or confirmation. Task status changes to “Needs Input” until user responds.

Availability

  • Tasks: ✓ Available
  • Subtasks: ✗ Not available (prevents blocking)

Restriction: This tool is only available in tasks, not subtasks. Subtasks run autonomously without blocking on user input.

Signature

 user_ask(
  question: string,
  options?: UserAskOptions
)

type UserAskOptions = {
  type?: "text" | "choice" | "confirm"
  choices?: string[]
  default?: string | boolean
} 

Parameters

Parameter Type Required Description
question string Required The question to ask the user
options UserAskOptions Optional Options for the question
options.type "text" | "choice" | "confirm" Optional Type of input expected (default: “text”)
options.choices string[] Optional Available choices (required for type: "choice" )
options.default string | boolean Optional Default value

Returns

User’s response as a string or boolean (depending on question type).

Behavior

  • Task status changes to “Needs Input” until user responds
  • Blocks task execution until user provides answer
  • Only available in tasks (not subtasks) to prevent blocking autonomous work

Example Usage

Text Input

 const apiKey = user_ask("What is your GitHub API key?") 

Multiple Choice

 const environment = user_ask(
  "Which environment should I deploy to?",
  {
    type: "choice",
    choices: ["staging", "production"],
    default: "staging"
  }
) 

Confirmation

 const proceed = user_ask(
  "This will delete all data. Are you sure?",
  {
    type: "confirm",
    default: false
  }
)

if (proceed) {
  // Execute destructive action
} 

Clarification During Execution

 // Gather requirements
const features = user_ask("Which features should I enable? (comma-separated)")

// Use the input
const featureList = features.split(",").map(f => f.trim()) 

Use Cases

Gather Missing Information

 const dbUrl = user_ask("What is the database connection string?") 

Confirm Destructive Actions

 const confirmed = user_ask(
  "This will overwrite existing files. Continue?",
  { type: "confirm" }
) 

Get User Preferences

 const style = user_ask(
  "Which code style do you prefer?",
  {
    type: "choice",
    choices: ["functional", "object-oriented"],
    default: "functional"
  }
) 

Found an error or want to improve this page?

Edit this page