Start Segwise Query
start_segwise_queryAnalyze the authenticated organization's advertising and creative performance or check its current generation token balance. Report that balance in generation tokens. Use this tool to compare performance and trends by app, campaign, ad network, creative, or creative tag and to analyze metrics including spend, impressions, clicks, installs, CTR, CVR, CPI, CPA, ROAS, revenue, and LTV. It can identify winning, declining, or fatigued creatives; explain which hooks, CTAs, visuals, themes, and formats drive results; and recommend what to scale, pause, refresh, or test next. It cannot modify campaigns. It creates a temporary background query job and may save conversation history. It returns a job_id immediately; call get_segwise_query with that exact job_id until the query reports completed or failed. Use operation=create_report or operation=update_report only when the user explicitly asks to save a new report or change an existing one. These operations persist changes in Segwise. Omit operation for analytics, including stored creative suggestions. If a write outcome is uncertain, inspect saved reports before starting another write. For custom AI tag creation, omit operation, app_names, and date_range. Show Chottu’s questions and results to the user. Pass the user’s actual replies unchanged with the same conversation_id, including confirmations and corrections. Wait for the user to confirm each step. For brand edits, omit operation and preserve the selected app scope. Show the full preview from get_segwise_query's result.answer, including its Markdown image links. If images cannot be rendered, present the links for review. For local files, copy the upload link exactly from the answer and wait for the user to attach the images. Proposals can import image files from shared Drive or Dropbox links. Wait for the user's explicit Save reply or revision and relay it unchanged with the same organization_id and conversation_id. Never generate a Save reply on the user's behalf. A confirmed save can replace or remove stored brand entries. For a selected local image or video use reference_upload only when the host can read the original bytes and make an HTTPS PUT. Poll for result.reference_upload, PUT the bytes with its exact headers and no MCP credentials, then pass its upload_id in reference_upload_ids on the plan request. Never put signed URLs in user-facing text. For static ads, users can browse their uploaded images. In video-enabled conversations they can also search and select their uploaded videos. Static generation requires conversation history and can spend the organization’s generation tokens after the user approves the plan. For static image generation, omit operation and use the same conversation_id and organization_id. Show the complete returned plan and estimated generation tokens, then wait for the user to confirm. Forward their actual reply unchanged; never supply confirmation yourself. A change requires a revised priced plan. After confirmation keep polling the same job and present each finished image link and any failures. For interrupted jobs ask for the existing static results in the same conversation. Never resend a confirmation to recover a result. For video requests omit operation, keep the same organization and conversation, and brainstorm with the user using their references. Show the complete written storyboard and both token estimates. Wait for their actual draft or full choice and forward it verbatim. For storyboard changes ask for a revision. For changes to a video made in this conversation show the edit and its estimate and wait for Apply edit. For a full-quality export, show the estimate and wait for the user’s export choice. Never supply a draft, full, export or Apply edit confirmation yourself. After submission, ask for video status in the same conversation until ready, then show the returned media link. Recover interrupted jobs by checking status. Never repeat a paid choice to retrieve a result. Queries can take several minutes and many status checks. A running status means the query is still executing, not that it failed or has no data. Keep calling get_segwise_query with the exact same job_id, respecting poll_after_seconds. Do not start a duplicate query or stop because repeated checks return running. Give brief progress updates while continuing to poll; do not finish with a still-running answer while polling remains available. Stop polling on completed, failed, execution_deadline, an unrecoverable error, or user cancellation. Retry transient status-check errors with bounded backoff and honor retry delays; do not retry authentication or permission failures. If the host prevents further execution, distinguish that interruption from query failure and preserve the job_id for resumption. organization_id is optional when exactly one organization is available; when multiple organizations are available, present only organization names to the user, map the chosen name to the corresponding organization_id, and retry without asking the user to read or type an ID. Use one Segwise conversation per user chat and organization. On the first question for an organization in a new chat, omit conversation_id and wait for start_segwise_query to return it before starting another query for that organization. For every later question in that chat, copy the exact conversation_id returned for that organization, even after a pause, a change of topic, or switching away from the organization and back. Recover the ID from earlier tool results when resuming a chat. A new user chat starts with no saved IDs. If the latest job in that conversation is running, set after_job_id to its job_id to queue the next question. Poll each question using its own job_id. When delegating, pass the conversation_id, organization_id and latest job_id to the agent and have it return the updated job_id. Route revisions and confirmations to the conversation containing the original proposal. Ask which proposal the user means if ambiguous. Set new_conversation=true and omit conversation_id only when the user requests a reset or Segwise reports missing or expired history.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"question": "<question>"
},
"name": "start_segwise_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| question | Yes | A question about advertising analytics or the current generation token balance, a video concept, storyboard, draft/full choice, video edit, status, static ad plan or confirmation, a conversational custom tag or brand editing request, or an explicit request to save or update a Segwise report. Forward the user’s actual confirmation verbatim after displaying the priced plan. Examples: Plan three static ads for my app.; Which hooks had the best ROAS on Meta last week?; Which creatives are showing fatigue?; Compare CPA and revenue across these apps.; What should we scale, pause, refresh, or test next? | |
| app_names | No | Optional app names to restrict analysis, brand edits, or an ad generation plan. Omit for an organization-wide brand edit. | |
| operation | No | Omit or set analyze for analytics. Set create_report only to save a new report or update_report only to edit an existing report, when the user explicitly requests it. | |
| date_range | No | Optional inclusive date range. | |
| after_job_id | No | If the latest job in this conversation is running, pass its job_id here with the same conversation_id to queue the next question. Omit when idle. | |
| conversation_id | No | Omit on the first start_segwise_query for this user chat and organization. Reuse the returned ID for every later question, including unrelated questions and delegated work. A new user chat starts fresh. | |
| organization_id | No | Exact organization_id returned by list_segwise_organizations. Optional only when the authenticated user has exactly one eligible organization. | |
| new_conversation | No | Set true for a user-requested reset or to recover from a missing or expired history error. Omit conversation_id when true. | |
| reference_upload | No | For a host with access to the selected file and HTTPS PUT, request a short-lived upload ticket for one local image or video. Poll this job for result.reference_upload. Omit operation and reference_upload_ids. | |
| reference_upload_ids | No | Up to ten upload IDs selected by the user or returned by a successful file transfer. Attach these with the video or static plan request; preserve the conversation. Omit operation and reference_upload. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes | Opaque handle for this query. Pass it unchanged to get_segwise_query until the query reaches a terminal status. | |
| status | Yes | Running means the job is executing or waiting for its predecessor. Continue polling its own job_id. | |
| message | Yes | Guidance for continuing this running query. | |
| next_action | Yes | Tool to call next with the same job_id. | |
| conversation_id | Yes | Keep this handle with the organization_id for every question in this user chat, including after a failed job. Pass both IDs to delegated agents. | |
| organization_id | Yes | ||
| organization_name | Yes | ||
| execution_deadline | Yes | Latest RFC3339 finish time. For a queued follow-up this includes its wait and execution budgets. Poll for its execution deadline once it starts. | |
| poll_after_seconds | Yes | Minimum delay in seconds before the next get_segwise_query call. | |
| waiting_for_job_id | No | Preceding job this follow-up is waiting for. Poll this follow-up using its own job_id. |