List Campaigns (Picker)
list_campaigns_pickerFetches a slim per-row campaign list (id, name, group_id, is_archived) for selection interfaces, avoiding heavy queries in large orgs. After selection, call get_campaign for full details.
Instructions
Slim per-row campaign list for selection UIs — id, name, group_id, is_archived. Cheaper than list_campaigns for orgs with thousands of campaigns. Use get_campaign(id) after a selection to fetch full details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The tool definition and handler function for list_campaigns_picker. It accepts no input (no params), calls ctx.api.listCampaignsPicker(), and returns a list of CampaignPickerItem (id, name, group_id, is_archived).
export const listCampaignsPickerTool: Tool< ListCampaignsPickerInputShape, ListCampaignsPickerOutput > = { name: "list_campaigns_picker", description: "Slim per-row campaign list for selection UIs — id, name, group_id, is_archived. Cheaper than `list_campaigns` for orgs with thousands of campaigns. Use `get_campaign(id)` after a selection to fetch full details.", annotations: { title: "List Campaigns (Picker)", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, inputSchema: z.object(ListCampaignsPickerInputShape), handler: async (_input, ctx): Promise<Result<ListCampaignsPickerOutput, ToolError>> => { const result = await ctx.api.listCampaignsPicker(); if (result.isErr()) return err(mapApiError(result.error)); return ok(result.value); }, }; - Input schema is an empty object (no parameters) and output type is readonly array of CampaignPickerItem.
const ListCampaignsPickerInputShape = {} as const; type ListCampaignsPickerInputShape = typeof ListCampaignsPickerInputShape; export type ListCampaignsPickerOutput = readonly CampaignPickerItem[]; - src/application/tool-registry.ts:137-137 (registration)The tool is imported and registered via registerAllTools() at line 137.
register(listCampaignsPickerTool); - Type definition for CampaignPickerItem — a pick of id, name, group_id, is_archived from the schema.
export type CampaignPickerItem = Pick< S["CampaignPickerItem"], "id" | "name" | "group_id" | "is_archived" >; - Parser that validates and transforms the raw API response for the picker endpoint.
const CampaignPickerSchema = schemas.CampaignPickerItem.pick({ id: true, name: true, group_id: true, is_archived: true, }).strip(); const CampaignPickerArraySchema = z.array(CampaignPickerSchema); export const parseCampaignPickerArray = ( raw: unknown ): Result<readonly CampaignPickerItem[], ApiError> => parseWithSchema(CampaignPickerArraySchema, raw, "campaigns-picker") as Result< readonly CampaignPickerItem[], ApiError >;