OpenCode icon

OpenCode

Interact with OpenCode Server API for AI coding assistant sessions

Message → Execute Command

AI-generated

Summary

Execute a slash command in an OpenCode session and return the response text and metadata.

Inputs

  • sessionMode — Choose how to handle sessions (existing or temporary).
  • sessionId (required) — Select a session for messaging (required when sessionMode is existing). Loaded via getSessions.
  • tempSessionTitle — Title for temporary sessions (for debugging purposes). Shown when sessionMode is temporary.
  • model — Select a model (optional, uses default if not specified). Loaded via getModels.
  • command (required) — Select a slash command to execute. Loaded via getCommands.
  • commandArguments — Arguments for the command in JSON format. Default empty string.
  • referencedFiles — Select files to reference in the message (will be prepended as @filename). Loaded via getFiles.
  • options — Additional options for command execution.

Output shape

object

Contains metadata about the executed command and the response text under the responseKey.

Links

Discussion