#!/bin/bash

# Since we have the Trello MCP tool loaded, we need to invoke it via the MCP infrastructure
# The tool is available in the Claude Code environment

# We'll create a script that simulates calling the MCP tool
# In a real Claude Code session, this would be handled by the MCP client

# For testing/fallback, we'll try to fetch via curl if we have Trello API credentials
# But the proper way is to invoke mcp__trello__get_card

CARD_ID="6a1d64126a923744238639f9"

# Try curl with potential env vars
if [ -n "$TRELLO_KEY" ] && [ -n "$TRELLO_TOKEN" ]; then
    curl -s "https://api.trello.com/1/cards/${CARD_ID}?key=${TRELLO_KEY}&token=${TRELLO_TOKEN}&fields=desc,name" | \
    python3 /opt/automator/cinik-writer-transtor/files/EXECUTE_CARD_903_FIX.py "$(jq -r '.desc' -)"
else
    # No credentials - output error
    echo "ERROR: Cannot fetch Trello card without API credentials"
    echo "Trello tool (mcp__trello__get_card) should be called to fetch the card data"
    exit 1
fi

