ConnectOnionConnectOnion
DocsUseful ToolsSlash Command

SlashCommand

Load and execute custom commands from markdown files.

Quick Start

main.py
1from connectonion import SlashCommand 2 3# Load command 4cmd = SlashCommand.load("today") 5 6# Get prompt 7prompt = cmd.prompt 8 9# List all commands 10commands = SlashCommand.list_all()

Command File Format

Create .co/commands/today.md:

code
1--- 2name: today 3description: Daily email briefing 4tools: 5 - Gmail.search_emails 6 - WebFetch 7--- 8Summarize my important emails from today. 9Focus on: 10- Urgent requests 11- Meeting invites 12- Follow-ups needed

YAML Frontmatter

FieldRequiredDescription
nameYesCommand name
descriptionYesShort description
toolsNoAllowed tools (all if omitted)

Tool Filtering

Limit which tools the command can use:

code
1tools: 2 - Gmail.search_emails # Specific method 3 - WebFetch # Whole class 4 - my_function # Standalone function

Locations

Commands are loaded from:

  1. .co/commands/*.md (user commands - priority)
  2. commands/*.md (built-in commands)

API

main.py
1# Load single command 2cmd = SlashCommand.load("today") 3cmd.name # "today" 4cmd.description # "Daily email briefing" 5cmd.prompt # "Summarize my important..." 6cmd.tools # ["Gmail.search_emails", "WebFetch"] 7 8# Filter tools for command 9filtered = cmd.filter_tools(all_tools) 10 11# List all available commands 12commands = SlashCommand.list_all() 13for cmd in commands: 14 print(f"/{cmd.name} - {cmd.description}")