Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/lib/protocols/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { AgentConfig } from '../types';
import type { PushNotificationConfig } from '../types/tools.generated';
import { getAuthToken } from '../auth';
import { validateAgentUrl } from '../validation';
import { checkToolSupportsPushNotification } from '../utils/tool-support';

/**
* Universal protocol client - automatically routes to the correct protocol implementation
Expand Down Expand Up @@ -43,7 +44,9 @@ export class ProtocolClient {
// Build push_notification_config for ASYNC TASK STATUS notifications
// (NOT for reporting_webhook - that stays in args)
// Schema: https://adcontextprotocol.org/schemas/v1/core/push-notification-config.json
const pushNotificationConfig: PushNotificationConfig | undefined = webhookUrl
// Only build for tools that support async task notifications
const shouldAddWebhook = checkToolSupportsPushNotification(toolName) && webhookUrl;
const pushNotificationConfig: PushNotificationConfig | undefined = shouldAddWebhook
? {
url: webhookUrl,
...(webhookToken && { token: webhookToken }),
Expand Down
3 changes: 3 additions & 0 deletions src/lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,6 @@ export type { AdCPResponse } from './response-unwrapper';

// Re-export protocol detection utilities
export { detectProtocol, detectProtocolWithTimeout } from './protocol-detection';

// Re-export tool support utilities
export { checkToolSupportsPushNotification } from './tool-support';
26 changes: 26 additions & 0 deletions src/lib/utils/tool-support.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Tool Support Utilities
*
* Checks which tools support specific AdCP features
*/

/**
* Check if a tool supports push_notification_config for async task notifications
*
* @param toolName - Name of the tool to check
* @returns true if the tool supports push_notification_config, false otherwise
*/
export function checkToolSupportsPushNotification(toolName: string | undefined): boolean {
if (!toolName) {
return false;
}

// Tools that support async task notifications via push_notification_config
const supportedTools = new Set([
'sync_creatives',
'create_media_buy',
'update_media_buy',
]);

return supportedTools.has(toolName.toLowerCase());
}
Loading