Skip to content

feat: add audience and campaign tools#17

Merged
maharshi-smallest merged 1 commit into
mainfrom
feat/audience-and-campaign-tools
Apr 24, 2026
Merged

feat: add audience and campaign tools#17
maharshi-smallest merged 1 commit into
mainfrom
feat/audience-and-campaign-tools

Conversation

@maharshi-smallest

Copy link
Copy Markdown
Collaborator

Summary

  • Adds 7 audience tools: get_audiences, get_audience, delete_audience, get_audience_members, search_audience_members, add_audience_members, delete_audience_members
  • Adds 6 campaign tools: create_campaign, get_campaign, start_campaign, pause_campaign, delete_campaign, export_campaign_logs

Total tools: 71 (up from 58)

Note: create_audience is not included because it requires CSV file upload (multipart form data) which MCP can't do. Users can create audiences in the console and use add_audience_members to manage contacts.

Test plan

  • Verify build passes (npm run build)
  • Test audience tools (list → get → add members → search → delete members)
  • Test campaign tools (create → start → pause → resume → export logs → delete)
  • Verify existing tools still work

🤖 Generated with Claude Code

Audiences (7 tools):
- get_audiences, get_audience, delete_audience
- get_audience_members, search_audience_members
- add_audience_members, delete_audience_members

Campaigns (6 tools):
- create_campaign, get_campaign, start_campaign
- pause_campaign, delete_campaign, export_campaign_logs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@entelligence-ai-pr-reviews

Copy link
Copy Markdown

EntelligenceAI PR Summary

This PR adds 13 new MCP tools across Audience and Campaign management domains, and reorganizes the tool registry into structured sections.

  • Audience tools: get_audiences, get_audience, delete_audience, get_audience_members (with a known page_sizeoffset mapping bug), search_audience_members, add_audience_members, delete_audience_members
  • Campaign tools: get_campaign, create_campaign, start_campaign, pause_campaign, delete_campaign, export_campaign_logs
  • All tools use Zod schema validation for inputs and formatApiError for error responses
  • src/tools/index.ts reorganized into 'Audiences', 'Campaigns', and 'Calls' sections

Confidence Score: 2/5 - Changes Needed

Not safe to merge — while this PR successfully adds 13 new MCP tools across Audience and Campaign management domains with a clean registry reorganization, there is a confirmed logic bug in get-audience-members.ts where the page_size parameter is serialized as offset= in the query string, meaning the API receives a record-offset value where it expects a page size. This will silently return incorrect pagination results for any caller using this tool, and notably the PR summary itself acknowledges a known page_sizeoffset mapping bug, indicating this shipped with awareness of the defect rather than being caught in review.

Key Findings:

  • In src/tools/get-audience-members.ts, the page_size parameter is incorrectly serialized as offset= in the constructed query string, causing the API to interpret a page-size value as a record offset — this means paginated results will be silently wrong for all consumers of this tool.
  • The PR summary explicitly calls out this mapping bug as 'known', which means it was knowingly merged with a defect rather than being blocked or tracked as a follow-up issue with appropriate guards, raising process concerns beyond just the technical bug.
  • The Campaign and Audience tools themselves appear well-structured with proper domain separation and a clean registry reorganization, suggesting the overall architecture is sound — the pagination bug is isolated but high-impact given it affects a core data retrieval operation.
Files requiring special attention
  • src/tools/get-audience-members.ts

@entelligence-ai-pr-reviews entelligence-ai-pr-reviews Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds 13 new MCP tools across Audience and Campaign management domains, and reorganizes the tool registry into structured sections.

  • Audience tools: get_audiences, get_audience, delete_audience, get_audience_members (with a known page_sizeoffset mapping bug), search_audience_members, add_audience_members, delete_audience_members
  • Campaign tools: get_campaign, create_campaign, start_campaign, pause_campaign, delete_campaign, export_campaign_logs
  • All tools use Zod schema validation for inputs and formatApiError for error responses
  • src/tools/index.ts reorganized into 'Audiences', 'Campaigns', and 'Calls' sections

const queryParts: string[] = [];
if (params.page !== undefined) queryParts.push(`page=${params.page}`);
if (params.page_size !== undefined) queryParts.push(`offset=${params.page_size}`);
const query = queryParts.length > 0 ? `?${queryParts.join("&")}` : "";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness: page_size is serialized as offset= instead of page_size=, so the API will receive a record-offset value where it expects a page size, silently returning wrong pagination results.

🤖 AI Agent Prompt for Cursor/Windsurf

📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue

In src/tools/get-audience-members.ts at line 22, the query parameter name is wrong. Change `offset=${params.page_size}` to `page_size=${params.page_size}` so the API receives the correct parameter name for page size instead of an offset value.

@maharshi-smallest maharshi-smallest merged commit df4c7dc into main Apr 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant