Orion CRM · MCP server
This app is the system of record for the Orion Photo Group demo: clients, talent, bookings, galleries and albums, cases and the open-jobs board. Decagon reaches it through one MCP server (synced as native mcp_ tools). Every console view polls the same data, so each tool call shows up here turn by turn.
Connect Decagon
- Decagon → Build → Integrations → MCP → add the URL above, then Sync. Tools appear as
mcp_<name>. - Re-sync whenever a tool's name or arguments change; review the diff before applying (sync overwrites local edits to synced tools).
- Outbound: Decagon places the call itself.
start_photographer_outreachreturns dial details and thecall_photographercoded tool runsConversation.schedule_mission_run. The app holds no Decagon credentials; Admin → Settings only needs the campaign ID and Decagon number.
Demo flows (3)
A · Jake (client)
“Where's my photographer?” → session starts in ≤30 min, not checked in → live call to Marcus (MyPhone) → ETA written to the booking → relayed in chat → “Thank you!” → conversation closes with no reply.
Nicole: situation 4 (thank-you close)B · Jake (client)
“Where's my album? I sent my design form 3 weeks ago” → stage from the production tracker → “My gallery is late, I want a refund” → guardrail → case with summary, canned handoff, chat closes.
Nicole: situations 1 and 3C · Sarah (talent)
“Confirm my arrival time and venue for Saturday's wedding” → call sheet → “What else is in the area?” → agent asks dates + location → “this weekend” / “yes, my location here in Manhattan” → carousel of 5 NYC jobs (of 10), highlighted on the Orion map.
Nicole: situation 2Metadata contract
| Key | Example | Set by | Used for |
|---|---|---|---|
| member_id | CL-10482 / TL-20771 | Orion web app (widget setMetadata) at login | get_member_context automation; every member tool |
| member_type | client / talent | Orion web app | AOP visibility: client AOPs vs talent AOP |
| first_name | Jake | Orion web app | Greeting before the automation returns |
| persona | jake / sarah | Orion web app | Demo filtering in Conversations |
| outbound_reason | photographer_eta_check | start_photographer_outreach (campaign metadata) | Force-visibility of the outbound voice AOP + welcome message |
| booking_id | BK-58213 | start_photographer_outreach (campaign metadata) | get_outreach_call_brief / record_outreach_result on the call |
Tool results are read straight off the tool (@mcp_get_client_bookings.next_booking_id), not copied into metadata.
Decagon configuration (team 5766)
Automation
Before conversation start: mcp get_member_context(member_id = metadata.member_id, phone = caller phone on voice). Loads the logged-in member live from the CRM so the first reply already knows who it is talking to.
AOPs
get_client_bookings → start_photographer_outreach → call_photographer → post_status_update → wait_for_outreach_result (loop) → get_outreach_status
Find today's session. If it starts within 30 minutes and the photographer has not checked in, tell the client you are calling the photographer now and start the outreach; wait for the result and relay ETA + message. Otherwise share the arrival time. If the wait times out, say the call is still in progress and use get_outreach_status when they ask again.
get_client_orders
Answer where the album / gallery is: current stage, what is done, what is next and the estimated date. Be honest when it is late. Never offer refunds or credits (the refund guardrail handles that).
get_talent_assignments · search_nearby_jobs → show_jobs_carousel (chat)
Confirm arrival time and venue address from the assignment. For 'what's in the area', ask which dates and which location (offer their saved home base) if not given, then search and show the carousel; on voice read the top three.
get_outreach_call_brief → record_outreach_result → hang_up
Disclose AI, confirm it is the photographer, explain the client is asking for an ETA, capture ETA and any message, read it back, record it, thank them and hang up. Voicemail: leave a short message, record reached=false.
create_case → send_handoff_and_close
Open a high-priority case with a full summary (order, stage, days late, what the client asked for), then send the canned handoff message and close the chat. No AI-written reply.
Guardrails
The user asks for a refund, money back, a credit, a discount or compensation for any Orion order, gallery, album or session.
The user's message only expresses thanks or a sign-off (e.g. 'thank you so much!', 'great, thanks') and contains no new question or request.
MCP tools (12)
Conversation context used by Before-conversation-start automation (chat + voice)
get_member_contextread-onlyGet member contextLook up the logged-in Orion member from the CRM at the start of every conversation (before-conversation-start automation). Tells the agent whether this is a client or talent and gives the key facts for routing: name, contact details and their next booking. Pass metadata.member_id; on voice without metadata pass the caller phone.
| member_id | string | null | Orion member ID: CL-xxxxx for clients, TL-xxxxx for talent. Read it from metadata.member_id (the logged-in Orion app sets it). Blank falls back to the member matching `phone`. |
| phone | string | null | Caller phone in any format. Used only when member_id is blank (voice calls without metadata). |
returns found, member_id, member_type (client|talent), first_name, last_name, email, phone, tier (client), neighborhood_or_home_base, role (talent), next_booking_id, next_booking_title, next_booking_starts_at, next_booking_starts_local, next_booking_minutes_until_start, next_booking_venue, open_case_count, error
Client sessions & deliverables used by Client: Session day & photographer status · Client: Gallery & album status
get_client_bookingsread-onlyGet client bookingsList a client's upcoming (and today's) sessions with the assigned photographer, venue, start time, minutes until start, whether the photographer has checked in on site, and the status of any live outreach to the photographer. Use when a client asks about a session or where their photographer is.
| member_id | string | null | Orion member ID: CL-xxxxx for clients, TL-xxxxx for talent. Read it from metadata.member_id (the logged-in Orion app sets it). Blank falls back to the member matching `phone`. |
| phone | string | null | Caller phone in any format. Used only when member_id is blank (voice calls without metadata). |
returns client_name, count, bookings[{booking_id, title, session_type, status, starts_at, starts_local, minutes_until_start, photographer_name, photographer_first_name, photographer_checked_in, photographer_due_on_site_local, venue_name, venue_address, package, outreach_status}], next_booking_id, next_booking_minutes_until_start, error
get_client_ordersread-onlyGet client galleries & albumsGet the status of a client's deliverables (online gallery and printed album) from the production tracker: current stage, every stage with dates, the delivery promise, whether it is late and by how many days, and the next estimated milestone. Use for 'where is my album/gallery' questions. Never promise a date earlier than estimated_delivery_local.
| member_id | string | null | Orion member ID: CL-xxxxx for clients, TL-xxxxx for talent. Read it from metadata.member_id (the logged-in Orion app sets it). Blank falls back to the member matching `phone`. |
| phone | string | null | Caller phone in any format. Used only when member_id is blank (voice calls without metadata). |
| kind | gallery | album | any | Filter to one deliverable type; default any. |
returns client_name, count, orders[{order_id, kind, title, stage, stage_number, stage_count, stages_done[], next_stage, stage_entered_local, days_in_stage, promised_local, is_late, days_late, estimated_next_milestone_local, estimated_delivery_local, editor, notes}], error
Live photographer outreach used by Client: Session day (chat) · Outbound: Photographer ETA check (voice)
start_photographer_outreachwrites CRMCall the photographer nowStart live outreach to the booking's photographer: marks the booking 'calling' in the CRM and returns the dial details (dial_target, decagon_phone_number, mission_id, call_metadata_json) that the call_photographer tool passes to Conversation.schedule_mission_run. Call this only after the AOP has decided outreach is warranted (the session starts within the outreach window and the photographer has not checked in). Then call call_photographer when should_dial is true, then wait_for_outreach_result. Idempotent: while a call is already in progress it returns should_dial=false.
| booking_id* | string | Booking ID, e.g. BK-58213, from get_client_bookings or get_talent_assignments. |
| reason | string | null | One line for the photographer, e.g. 'Client is at Bow Bridge and asking for your ETA.' |
| conversation_id | string | null | This chat's Decagon conversation ID, if available, so the CRM links the call to the chat. |
returns ok, booking_id, outreach_status (calling|failed), already_in_progress, should_dial, dial_target, decagon_phone_number, mission_id, scheduled_at_utc, call_metadata_json, photographer_first_name, photographer_name, calling_number_last4, started_at, error (booking_not_found | outbound_not_configured)
wait_for_outreach_resultread-onlyWait for the photographer call resultWait for the outbound call to the photographer to finish. Watches the booking's outreach field for up to max_wait_seconds (default 20) and returns the moment the result is in. done=false means the call is still going: call this again (or, if the client asks later, use get_outreach_status). When done, tell the client the photographer's ETA and message in plain words.
| booking_id* | string | Booking ID, e.g. BK-58213, from get_client_bookings or get_talent_assignments. |
| max_wait_seconds | number | How long to wait inside this call, 1-25 seconds (default 20). |
returns done, outreach_status (not_started|calling|completed|no_answer|failed), reached, eta_minutes, eta_local, running_late, photographer_message, summary, seconds_waited, seconds_since_call_started, error
get_outreach_statusread-onlyGet photographer outreach statusInstant read of the live-outreach field on a booking (no waiting). Use when the client asks for an update after wait_for_outreach_result timed out, or later in the conversation.
| booking_id* | string | Booking ID, e.g. BK-58213, from get_client_bookings or get_talent_assignments. |
returns done, outreach_status, reached, eta_minutes, eta_local, running_late, photographer_message, summary, started_at, completed_at, attempts, error
get_outreach_call_briefread-onlyGet outreach call briefOutbound voice AOP: load what the photographer needs to hear at the start of the call: who is asking, the session, venue and start time, and how late they are relative to their on-site time. Pass metadata.booking_id from the campaign.
| booking_id* | string | Booking ID, e.g. BK-58213, from get_client_bookings or get_talent_assignments. |
returns booking_id, photographer_first_name, client_name, client_first_name, session_type, venue_name, venue_address, starts_local, minutes_until_start, due_on_site_local, minutes_past_due_on_site, reason, onsite_contact, error
record_outreach_resultwrites CRMRecord photographer call resultOutbound voice AOP: write what the photographer said back to the CRM booking. Call once, before ending the call, whatever happened (reached=false for voicemail or no answer). This is what the client's chat is waiting on.
| booking_id* | string | Booking ID, e.g. BK-58213, from get_client_bookings or get_talent_assignments. |
| reached* | boolean | true when the photographer was on the line. |
| eta_minutes | number | null | Minutes until they arrive on site, as they said it ('ten minutes' = 10). |
| running_late | boolean | null | true if they will arrive after the session start time. |
| photographer_message | string | null | Anything they asked you to pass on to the client, in their words. |
| summary | string | null | One sentence for the CRM, e.g. 'Marcus is on the 1 train, 10 minutes out, apologizes for the delay.' |
| call_conversation_id | string | null | This call's Decagon conversation ID, if available. |
returns ok, booking_id, outreach_status (completed|no_answer), eta_local, error
Talent assignments & opportunities used by Talent: Assignments & nearby opportunities
get_talent_assignmentsread-onlyGet talent assignmentsList a talent member's upcoming assignments with everything needed to confirm a shoot: arrival time on site, start time, venue name and full address, on-site contact and the call sheet (parking, dress code, notes). Use when a photographer asks to confirm arrival time or venue.
| member_id | string | null | Orion member ID: CL-xxxxx for clients, TL-xxxxx for talent. Read it from metadata.member_id (the logged-in Orion app sets it). Blank falls back to the member matching `phone`. |
| phone | string | null | Caller phone in any format. Used only when member_id is blank (voice calls without metadata). |
returns talent_name, home_base, count, assignments[{booking_id, title, session_type, day_local, arrival_local, starts_local, ends_local, venue_name, venue_address, onsite_contact, call_sheet, client_name}], error
search_nearby_jobsread-onlySearch open jobs near the talentFind open Orion jobs for a talent member by date window and location: returns only jobs inside the window, within radius_miles of the location, and not clashing with the talent's own assignments. Collect the date window and location from the talent first (e.g. 'this weekend', 'my location in Manhattan' = near=home_base). Each job carries a destination photo (image_url) for the chat carousel and highlights on the Orion talent map.
| member_id | string | null | Orion member ID: CL-xxxxx for clients, TL-xxxxx for talent. Read it from metadata.member_id (the logged-in Orion app sets it). Blank falls back to the member matching `phone`. |
| date_window* | this_weekend | next_weekend | next_7_days | custom | Which dates the talent asked about. 'custom' uses start_date/end_date. |
| start_date | string | null | Custom window start (YYYY-MM-DD), only for date_window=custom. |
| end_date | string | null | Custom window end inclusive (YYYY-MM-DD), only for date_window=custom. |
| near | string | null | 'home_base' (their saved location) or a NYC neighborhood/borough they named. Default home_base. |
| radius_miles | number | Search radius in miles (default 15). |
returns count, window_label, near_label, radius_miles, excluded_conflicts, excluded_out_of_area, jobs[{job_id, title, client_type, day_local, time_local, duration_minutes, pay, pay_label, location_name, address, borough, miles_away, image_url, map_url, tags, description}], talent_map_url, error
Cases used by Refund request handoff (guardrail AOP)
create_casewrites CRMCreate CRM caseOpen a case in the Orion CRM for a human specialist, with a summary of the conversation so the client never has to repeat themselves. Used by the refund-request handoff: the AI does not decide refunds. Returns the case number to reference.
| member_id | string | null | Orion member ID: CL-xxxxx for clients, TL-xxxxx for talent. Read it from metadata.member_id (the logged-in Orion app sets it). Blank falls back to the member matching `phone`. |
| case_type* | refund_request | complaint | reschedule | general | What the case is about. |
| subject* | string | Short subject line, e.g. 'Refund request: wedding gallery 8 days late'. |
| summary* | string | Three to five sentences: what the client asked for, the facts from the CRM (order, stage, days late), their tone, and what they want. |
| priority | low | normal | high | urgent | Default high for refund requests and upset clients. |
| related_order_id | string | null | Order ID the request is about, if known (e.g. ORD-7731). |
| conversation_id | string | null | Decagon conversation ID, if available. |
returns ok, case_id, queue, priority, status, sla_label, error
Demo control used by Presenter only
reset_demowrites CRMReset demo dataRebuild the CRM from the demo baseline (times re-anchored to now) and clear the activity feed. Presenter control only; never call in a customer conversation.
returns ok, error
Coded tools (Python, in Decagon)
show_jobs_carousel · Renders search_nearby_jobs results as a chat carousel with destination photos.
jobs = search_nearby_jobs.get("jobs") or [] # input variable mapped to @search_nearby_jobs.jobs
if jobs:
Conversation.set_item_carousel({
"title": f"Open jobs {search_nearby_jobs.get('window_label', '')}",
"card_size": "medium",
"items": [{
"card_id": j["job_id"],
"title": j["title"],
"subtitle": f"{j['location_name']} · {j['miles_away']} mi",
"image_url": j["image_url"],
"badges": [{"label": j["pay_label"], "position": "top-left"}],
"tags": [j["day_local"], j["time_local"]],
"description": j["description"],
"actions": {"chips": [
{"label": "I'm interested", "handler": None, "url": None},
{"label": "View on map", "url": j["map_url"]},
]},
"on_click": {"type": "send_message", "text": f"Tell me more about {j['title']} ({j['job_id']})."},
} for j in jobs],
}, {"generate_ai_message": True, "send_after_message": True})
return {"shown": len(jobs)}call_photographer · Places the outbound voice call natively in Decagon (no API key in the app), using the dial details from start_photographer_outreach.
import json
o = start_photographer_outreach # input variable mapped to @mcp_start_photographer_outreach
if not o.get("should_dial"):
return {"dialed": False, "reason": "already_in_progress_or_not_configured"}
Conversation.schedule_mission_run(
mission_id=o["mission_id"],
recipient=o["dial_target"],
decagon_phone_number=o["decagon_phone_number"],
scheduled_at_utc=o["scheduled_at_utc"],
metadata=json.loads(o["call_metadata_json"]),
recipient_country_code="US",
)
return {"dialed": True}post_status_update · Writes an interim message immediately (e.g. 'Calling Marcus now…') before the agent waits on the call.
Conversation.write_message(message)
return {"ok": True}send_handoff_and_close · Deterministic, professional handoff message, then ends the chat (no AI reply).
Conversation.write_message(
f"Thank you, {first_name}. I've passed your request to our Client Care team with a full summary "
f"(case {case_id}). A specialist will contact you directly within 4 business hours. This chat will now close."
)
Conversation.close()
Conversation.stop_writing()
return {"closed": True}close_without_reply · Recognizes a thank-you and closes the conversation without sending anything.
Conversation.close()
return {"closed": True}Error contract
| member_not_found | No client or talent matches member_id / phone. |
| not_a_client / not_talent | The member exists but is the other persona type. |
| booking_not_found | No booking with that ID. |
| outbound_not_configured | Campaign ID or Decagon number missing (Admin → Settings). |
| invalid_date | Custom dates are not YYYY-MM-DD. |
| invalid_input | Arguments failed validation (details in `detail`). |
Every result has an error field (null on success), so AOPs branch with a coded condition instead of parsing text.
REST API (same logic as MCP)
GET /api/public/tools # catalog with JSON schemas
POST /api/public/tools/<tool> # body = arguments → { ok, tool, result }
GET /api/public/state # whole CRM + activity (console polling)
POST /api/public/admin # { action: reset | settings | save_entity }
GET /img/<job_id> # destination photo redirect for carousels
curl -s -X POST https://<this-app>/api/public/tools/search_nearby_jobs \
-H 'content-type: application/json' \
-d '{"member_id":"TL-20771","date_window":"this_weekend","near":"home_base"}'