adcp 2.18.0__py3-none-any.whl → 3.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- adcp/ADCP_VERSION +1 -1
- adcp/__init__.py +6 -14
- adcp/__main__.py +94 -51
- adcp/adagents.py +91 -19
- adcp/client.py +865 -0
- adcp/protocols/a2a.py +84 -0
- adcp/protocols/base.py +101 -0
- adcp/protocols/mcp.py +87 -1
- adcp/server/__init__.py +49 -0
- adcp/server/base.py +368 -0
- adcp/server/content_standards.py +561 -0
- adcp/server/governance.py +491 -0
- adcp/server/mcp_tools.py +471 -0
- adcp/server/proposal.py +334 -0
- adcp/server/sponsored_intelligence.py +444 -0
- adcp/types/__init__.py +111 -23
- adcp/types/_ergonomic.py +35 -18
- adcp/types/_generated.py +419 -44
- adcp/types/aliases.py +13 -20
- adcp/types/base.py +1 -1
- adcp/types/generated_poc/adagents.py +103 -6
- adcp/types/generated_poc/content_standards/__init__.py +3 -0
- adcp/types/generated_poc/content_standards/artifact.py +208 -0
- adcp/types/generated_poc/content_standards/artifact_webhook_payload.py +64 -0
- adcp/types/generated_poc/content_standards/calibrate_content_request.py +17 -0
- adcp/types/generated_poc/content_standards/calibrate_content_response.py +74 -0
- adcp/types/generated_poc/content_standards/content_standards.py +66 -0
- adcp/types/generated_poc/content_standards/create_content_standards_request.py +97 -0
- adcp/types/generated_poc/content_standards/create_content_standards_response.py +52 -0
- adcp/types/generated_poc/content_standards/get_content_standards_request.py +21 -0
- adcp/types/generated_poc/content_standards/get_content_standards_response.py +43 -0
- adcp/types/generated_poc/content_standards/get_media_buy_artifacts_request.py +64 -0
- adcp/types/generated_poc/content_standards/get_media_buy_artifacts_response.py +117 -0
- adcp/types/generated_poc/content_standards/list_content_standards_request.py +31 -0
- adcp/types/generated_poc/content_standards/list_content_standards_response.py +48 -0
- adcp/types/generated_poc/content_standards/update_content_standards_request.py +101 -0
- adcp/types/generated_poc/content_standards/update_content_standards_response.py +34 -0
- adcp/types/generated_poc/content_standards/validate_content_delivery_request.py +59 -0
- adcp/types/generated_poc/content_standards/validate_content_delivery_response.py +85 -0
- adcp/types/generated_poc/core/activation_key.py +1 -1
- adcp/types/generated_poc/core/assets/audio_asset.py +1 -1
- adcp/types/generated_poc/core/assets/css_asset.py +1 -1
- adcp/types/generated_poc/core/assets/daast_asset.py +1 -1
- adcp/types/generated_poc/core/assets/html_asset.py +1 -1
- adcp/types/generated_poc/core/assets/image_asset.py +1 -1
- adcp/types/generated_poc/core/assets/javascript_asset.py +1 -1
- adcp/types/generated_poc/core/assets/text_asset.py +1 -1
- adcp/types/generated_poc/core/assets/url_asset.py +1 -1
- adcp/types/generated_poc/core/assets/vast_asset.py +1 -1
- adcp/types/generated_poc/core/assets/video_asset.py +1 -1
- adcp/types/generated_poc/core/assets/webhook_asset.py +1 -1
- adcp/types/generated_poc/core/async_response_data.py +1 -1
- adcp/types/generated_poc/core/brand_manifest.py +68 -5
- adcp/types/generated_poc/core/brand_manifest_ref.py +1 -1
- adcp/types/generated_poc/core/context.py +1 -1
- adcp/types/generated_poc/core/creative_asset.py +8 -7
- adcp/types/generated_poc/core/creative_assignment.py +1 -1
- adcp/types/generated_poc/core/creative_filters.py +4 -14
- adcp/types/generated_poc/core/creative_manifest.py +1 -1
- adcp/types/generated_poc/core/creative_policy.py +1 -1
- adcp/types/generated_poc/core/delivery_metrics.py +1 -1
- adcp/types/generated_poc/core/deployment.py +1 -1
- adcp/types/generated_poc/core/destination.py +1 -1
- adcp/types/generated_poc/core/error.py +1 -1
- adcp/types/generated_poc/core/ext.py +1 -1
- adcp/types/generated_poc/core/format.py +6 -5
- adcp/types/generated_poc/core/format_id.py +1 -1
- adcp/types/generated_poc/core/frequency_cap.py +1 -1
- adcp/types/generated_poc/core/identifier.py +27 -0
- adcp/types/generated_poc/core/mcp_webhook_payload.py +1 -1
- adcp/types/generated_poc/core/measurement.py +1 -1
- adcp/types/generated_poc/core/media_buy.py +1 -1
- adcp/types/generated_poc/core/media_buy_features.py +29 -0
- adcp/types/generated_poc/core/offering.py +80 -0
- adcp/types/generated_poc/core/package.py +1 -1
- adcp/types/generated_poc/core/performance_feedback.py +1 -1
- adcp/types/generated_poc/core/placement.py +1 -1
- adcp/types/generated_poc/core/pricing_option.py +8 -14
- adcp/types/generated_poc/core/product.py +1 -1
- adcp/types/generated_poc/core/product_allocation.py +48 -0
- adcp/types/generated_poc/core/product_filters.py +72 -7
- adcp/types/generated_poc/core/promoted_offerings.py +12 -21
- adcp/types/generated_poc/core/promoted_products.py +1 -1
- adcp/types/generated_poc/core/property.py +1 -1
- adcp/types/generated_poc/core/property_id.py +1 -1
- adcp/types/generated_poc/core/property_list_ref.py +26 -0
- adcp/types/generated_poc/core/property_tag.py +1 -1
- adcp/types/generated_poc/core/proposal.py +64 -0
- adcp/types/generated_poc/core/protocol_envelope.py +1 -1
- adcp/types/generated_poc/core/publisher_property_selector.py +1 -1
- adcp/types/generated_poc/core/push_notification_config.py +1 -1
- adcp/types/generated_poc/core/reporting_capabilities.py +1 -1
- adcp/types/generated_poc/core/reporting_webhook.py +70 -0
- adcp/types/generated_poc/core/response.py +1 -1
- adcp/types/generated_poc/core/signal_filters.py +1 -1
- adcp/types/generated_poc/core/start_timing.py +4 -4
- adcp/types/generated_poc/core/sub_asset.py +1 -1
- adcp/types/generated_poc/core/targeting.py +55 -14
- adcp/types/generated_poc/creative/list_creative_formats_request.py +1 -1
- adcp/types/generated_poc/creative/list_creative_formats_response.py +1 -1
- adcp/types/generated_poc/creative/preview_creative_request.py +1 -1
- adcp/types/generated_poc/creative/preview_creative_response.py +3 -2
- adcp/types/generated_poc/creative/preview_render.py +1 -1
- adcp/types/generated_poc/enums/adcp_domain.py +3 -1
- adcp/types/generated_poc/enums/asset_content_type.py +1 -1
- adcp/types/generated_poc/enums/auth_scheme.py +1 -1
- adcp/types/generated_poc/enums/available_metric.py +1 -1
- adcp/types/generated_poc/enums/channels.py +18 -8
- adcp/types/generated_poc/enums/co_branding_requirement.py +1 -1
- adcp/types/generated_poc/enums/creative_action.py +1 -1
- adcp/types/generated_poc/enums/creative_agent_capability.py +1 -1
- adcp/types/generated_poc/enums/creative_sort_field.py +1 -1
- adcp/types/generated_poc/enums/creative_status.py +2 -1
- adcp/types/generated_poc/enums/daast_tracking_event.py +1 -1
- adcp/types/generated_poc/enums/daast_version.py +1 -1
- adcp/types/generated_poc/enums/delivery_type.py +1 -1
- adcp/types/generated_poc/enums/dimension_unit.py +1 -1
- adcp/types/generated_poc/enums/feed_format.py +1 -1
- adcp/types/generated_poc/enums/feedback_source.py +1 -1
- adcp/types/generated_poc/enums/format_category.py +1 -1
- adcp/types/generated_poc/enums/format_id_parameter.py +1 -1
- adcp/types/generated_poc/enums/frequency_cap_scope.py +1 -1
- adcp/types/generated_poc/enums/geo_level.py +14 -0
- adcp/types/generated_poc/enums/history_entry_type.py +1 -1
- adcp/types/generated_poc/enums/http_method.py +1 -1
- adcp/types/generated_poc/enums/identifier_types.py +1 -1
- adcp/types/generated_poc/enums/javascript_module_type.py +1 -1
- adcp/types/generated_poc/enums/landing_page_requirement.py +1 -1
- adcp/types/generated_poc/enums/markdown_flavor.py +1 -1
- adcp/types/generated_poc/enums/media_buy_status.py +1 -1
- adcp/types/generated_poc/enums/metric_type.py +1 -1
- adcp/types/generated_poc/enums/metro_system.py +15 -0
- adcp/types/generated_poc/enums/notification_type.py +1 -1
- adcp/types/generated_poc/enums/pacing.py +1 -1
- adcp/types/generated_poc/enums/postal_system.py +19 -0
- adcp/types/generated_poc/enums/preview_output_format.py +1 -1
- adcp/types/generated_poc/enums/pricing_model.py +1 -1
- adcp/types/generated_poc/enums/property_type.py +2 -1
- adcp/types/generated_poc/enums/publisher_identifier_types.py +1 -1
- adcp/types/generated_poc/enums/reporting_frequency.py +1 -1
- adcp/types/generated_poc/enums/signal_catalog_type.py +1 -1
- adcp/types/generated_poc/enums/sort_direction.py +1 -1
- adcp/types/generated_poc/enums/task_status.py +1 -1
- adcp/types/generated_poc/enums/task_type.py +7 -1
- adcp/types/generated_poc/enums/update_frequency.py +1 -1
- adcp/types/generated_poc/enums/url_asset_type.py +1 -1
- adcp/types/generated_poc/enums/validation_mode.py +1 -1
- adcp/types/generated_poc/enums/vast_tracking_event.py +1 -1
- adcp/types/generated_poc/enums/vast_version.py +1 -1
- adcp/types/generated_poc/enums/webhook_response_type.py +1 -1
- adcp/types/generated_poc/enums/webhook_security_method.py +1 -1
- adcp/types/generated_poc/extensions/__init__.py +3 -0
- adcp/types/generated_poc/extensions/extension_meta.py +58 -0
- adcp/types/generated_poc/media_buy/build_creative_request.py +1 -1
- adcp/types/generated_poc/media_buy/build_creative_response.py +1 -1
- adcp/types/generated_poc/media_buy/create_media_buy_async_response_input_required.py +1 -1
- adcp/types/generated_poc/media_buy/create_media_buy_async_response_submitted.py +1 -1
- adcp/types/generated_poc/media_buy/create_media_buy_async_response_working.py +1 -1
- adcp/types/generated_poc/media_buy/create_media_buy_request.py +54 -26
- adcp/types/generated_poc/media_buy/create_media_buy_response.py +1 -1
- adcp/types/generated_poc/media_buy/get_media_buy_delivery_request.py +1 -1
- adcp/types/generated_poc/media_buy/get_media_buy_delivery_response.py +1 -1
- adcp/types/generated_poc/media_buy/get_products_async_response_input_required.py +1 -1
- adcp/types/generated_poc/media_buy/get_products_async_response_submitted.py +1 -1
- adcp/types/generated_poc/media_buy/get_products_async_response_working.py +1 -1
- adcp/types/generated_poc/media_buy/get_products_request.py +18 -3
- adcp/types/generated_poc/media_buy/get_products_response.py +14 -2
- adcp/types/generated_poc/media_buy/list_authorized_properties_request.py +1 -1
- adcp/types/generated_poc/media_buy/list_authorized_properties_response.py +2 -2
- adcp/types/generated_poc/media_buy/list_creative_formats_request.py +1 -1
- adcp/types/generated_poc/media_buy/list_creative_formats_response.py +1 -1
- adcp/types/generated_poc/media_buy/list_creatives_request.py +2 -2
- adcp/types/generated_poc/media_buy/list_creatives_response.py +7 -10
- adcp/types/generated_poc/media_buy/package_request.py +15 -6
- adcp/types/generated_poc/media_buy/package_update.py +119 -0
- adcp/types/generated_poc/media_buy/provide_performance_feedback_request.py +1 -1
- adcp/types/generated_poc/media_buy/provide_performance_feedback_response.py +1 -1
- adcp/types/generated_poc/media_buy/sync_creatives_async_response_input_required.py +1 -1
- adcp/types/generated_poc/media_buy/sync_creatives_async_response_submitted.py +1 -1
- adcp/types/generated_poc/media_buy/sync_creatives_async_response_working.py +1 -1
- adcp/types/generated_poc/media_buy/sync_creatives_request.py +1 -1
- adcp/types/generated_poc/media_buy/sync_creatives_response.py +1 -1
- adcp/types/generated_poc/media_buy/update_media_buy_async_response_input_required.py +1 -1
- adcp/types/generated_poc/media_buy/update_media_buy_async_response_submitted.py +1 -1
- adcp/types/generated_poc/media_buy/update_media_buy_async_response_working.py +1 -1
- adcp/types/generated_poc/media_buy/update_media_buy_request.py +20 -108
- adcp/types/generated_poc/media_buy/update_media_buy_response.py +1 -1
- adcp/types/generated_poc/pricing_options/cpc_option.py +35 -10
- adcp/types/generated_poc/pricing_options/cpcv_option.py +35 -10
- adcp/types/generated_poc/pricing_options/{cpm_auction_option.py → cpm_option.py} +23 -19
- adcp/types/generated_poc/pricing_options/cpp_option.py +39 -16
- adcp/types/generated_poc/pricing_options/cpv_option.py +37 -18
- adcp/types/generated_poc/pricing_options/flat_rate_option.py +45 -39
- adcp/types/generated_poc/pricing_options/{vcpm_auction_option.py → vcpm_option.py} +23 -14
- adcp/types/generated_poc/property/__init__.py +3 -0
- adcp/types/generated_poc/property/base_property_source.py +86 -0
- adcp/types/generated_poc/property/create_property_list_request.py +43 -0
- adcp/types/generated_poc/property/create_property_list_response.py +27 -0
- adcp/types/generated_poc/property/delete_property_list_request.py +22 -0
- adcp/types/generated_poc/property/delete_property_list_response.py +21 -0
- adcp/types/generated_poc/property/feature_requirement.py +42 -0
- adcp/types/generated_poc/property/get_property_list_request.py +34 -0
- adcp/types/generated_poc/property/get_property_list_response.py +61 -0
- adcp/types/generated_poc/property/list_property_lists_request.py +29 -0
- adcp/types/generated_poc/property/list_property_lists_response.py +39 -0
- adcp/types/generated_poc/property/property_error.py +33 -0
- adcp/types/generated_poc/property/property_feature.py +22 -0
- adcp/types/generated_poc/property/property_feature_definition.py +80 -0
- adcp/types/generated_poc/property/property_list.py +62 -0
- adcp/types/generated_poc/property/property_list_changed_webhook.py +51 -0
- adcp/types/generated_poc/property/property_list_filters.py +47 -0
- adcp/types/generated_poc/property/update_property_list_request.py +46 -0
- adcp/types/generated_poc/property/update_property_list_response.py +21 -0
- adcp/types/generated_poc/protocol/__init__.py +3 -0
- adcp/types/generated_poc/protocol/get_adcp_capabilities_request.py +34 -0
- adcp/types/generated_poc/protocol/get_adcp_capabilities_response.py +353 -0
- adcp/types/generated_poc/protocols/adcp_extension.py +18 -5
- adcp/types/generated_poc/signals/activate_signal_request.py +1 -1
- adcp/types/generated_poc/signals/activate_signal_response.py +1 -1
- adcp/types/generated_poc/signals/get_signals_request.py +1 -1
- adcp/types/generated_poc/signals/get_signals_response.py +1 -1
- adcp/types/generated_poc/sponsored_intelligence/__init__.py +3 -0
- adcp/types/generated_poc/sponsored_intelligence/si_capabilities.py +102 -0
- adcp/types/generated_poc/sponsored_intelligence/si_get_offering_request.py +34 -0
- adcp/types/generated_poc/sponsored_intelligence/si_get_offering_response.py +100 -0
- adcp/types/generated_poc/sponsored_intelligence/si_identity.py +78 -0
- adcp/types/generated_poc/sponsored_intelligence/si_initiate_session_request.py +46 -0
- adcp/types/generated_poc/sponsored_intelligence/si_initiate_session_response.py +44 -0
- adcp/types/generated_poc/sponsored_intelligence/si_send_message_request.py +58 -0
- adcp/types/generated_poc/sponsored_intelligence/si_send_message_response.py +101 -0
- adcp/types/generated_poc/sponsored_intelligence/si_terminate_session_request.py +60 -0
- adcp/types/generated_poc/sponsored_intelligence/si_terminate_session_response.py +54 -0
- adcp/types/generated_poc/sponsored_intelligence/si_ui_element.py +30 -0
- adcp/utils/format_assets.py +5 -5
- adcp/utils/preview_cache.py +2 -2
- {adcp-2.18.0.dist-info → adcp-3.0.0.dist-info}/METADATA +1 -1
- adcp-3.0.0.dist-info/RECORD +264 -0
- {adcp-2.18.0.dist-info → adcp-3.0.0.dist-info}/WHEEL +1 -1
- adcp/types/generated_poc/enums/standard_format_ids.py +0 -45
- adcp/types/generated_poc/pricing_options/cpm_fixed_option.py +0 -43
- adcp/types/generated_poc/pricing_options/vcpm_fixed_option.py +0 -47
- adcp-2.18.0.dist-info/RECORD +0 -195
- {adcp-2.18.0.dist-info → adcp-3.0.0.dist-info}/entry_points.txt +0 -0
- {adcp-2.18.0.dist-info → adcp-3.0.0.dist-info}/licenses/LICENSE +0 -0
- {adcp-2.18.0.dist-info → adcp-3.0.0.dist-info}/top_level.txt +0 -0
adcp/server/mcp_tools.py
ADDED
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
"""MCP server integration helpers.
|
|
2
|
+
|
|
3
|
+
Provides utilities for registering ADCP handlers with MCP servers.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from collections.abc import Callable
|
|
9
|
+
from typing import TYPE_CHECKING, Any
|
|
10
|
+
|
|
11
|
+
from adcp.server.base import ADCPHandler, ToolContext
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# Tool definitions for all ADCP operations
|
|
18
|
+
ADCP_TOOL_DEFINITIONS: list[dict[str, Any]] = [
|
|
19
|
+
# Core Catalog Operations
|
|
20
|
+
{
|
|
21
|
+
"name": "get_products",
|
|
22
|
+
"description": "Get advertising products from the catalog",
|
|
23
|
+
"inputSchema": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"context": {"type": "object"},
|
|
27
|
+
"filters": {"type": "object"},
|
|
28
|
+
"pagination": {"type": "object"},
|
|
29
|
+
"fields": {"type": "array", "items": {"type": "string"}},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "list_creative_formats",
|
|
35
|
+
"description": "List supported creative formats",
|
|
36
|
+
"inputSchema": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"properties": {
|
|
39
|
+
"type": {"type": "string"},
|
|
40
|
+
"format_id": {"type": "string"},
|
|
41
|
+
"pagination": {"type": "object"},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "list_authorized_properties",
|
|
47
|
+
"description": "List properties authorized for ad placement",
|
|
48
|
+
"inputSchema": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"properties": {
|
|
51
|
+
"filters": {"type": "object"},
|
|
52
|
+
"pagination": {"type": "object"},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
# Creative Operations
|
|
57
|
+
{
|
|
58
|
+
"name": "sync_creatives",
|
|
59
|
+
"description": "Sync creatives to the agent",
|
|
60
|
+
"inputSchema": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"properties": {
|
|
63
|
+
"creatives": {"type": "array"},
|
|
64
|
+
},
|
|
65
|
+
"required": ["creatives"],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "list_creatives",
|
|
70
|
+
"description": "List synced creatives",
|
|
71
|
+
"inputSchema": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"properties": {
|
|
74
|
+
"filters": {"type": "object"},
|
|
75
|
+
"pagination": {"type": "object"},
|
|
76
|
+
"fields": {"type": "array", "items": {"type": "string"}},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "build_creative",
|
|
82
|
+
"description": "Build a creative from assets",
|
|
83
|
+
"inputSchema": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"properties": {
|
|
86
|
+
"format_id": {"type": "string"},
|
|
87
|
+
"assets": {"type": "array"},
|
|
88
|
+
},
|
|
89
|
+
"required": ["format_id", "assets"],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
# Media Buy Operations
|
|
93
|
+
{
|
|
94
|
+
"name": "create_media_buy",
|
|
95
|
+
"description": "Create a media buy from products",
|
|
96
|
+
"inputSchema": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"packages": {"type": "array"},
|
|
100
|
+
"proposal_id": {"type": "string"},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "update_media_buy",
|
|
106
|
+
"description": "Update an existing media buy",
|
|
107
|
+
"inputSchema": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"properties": {
|
|
110
|
+
"media_buy_id": {"type": "string"},
|
|
111
|
+
"packages": {"type": "array"},
|
|
112
|
+
},
|
|
113
|
+
"required": ["media_buy_id"],
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "get_media_buy_delivery",
|
|
118
|
+
"description": "Get delivery metrics for a media buy",
|
|
119
|
+
"inputSchema": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"properties": {
|
|
122
|
+
"media_buy_id": {"type": "string"},
|
|
123
|
+
"metrics": {"type": "array", "items": {"type": "string"}},
|
|
124
|
+
},
|
|
125
|
+
"required": ["media_buy_id"],
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
# Signal Operations
|
|
129
|
+
{
|
|
130
|
+
"name": "get_signals",
|
|
131
|
+
"description": "Get available signals",
|
|
132
|
+
"inputSchema": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"properties": {
|
|
135
|
+
"filters": {"type": "object"},
|
|
136
|
+
"pagination": {"type": "object"},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "activate_signal",
|
|
142
|
+
"description": "Activate a signal for use",
|
|
143
|
+
"inputSchema": {
|
|
144
|
+
"type": "object",
|
|
145
|
+
"properties": {
|
|
146
|
+
"signal_id": {"type": "string"},
|
|
147
|
+
"activation_key": {"type": "string"},
|
|
148
|
+
},
|
|
149
|
+
"required": ["signal_id"],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
# Feedback Operations
|
|
153
|
+
{
|
|
154
|
+
"name": "provide_performance_feedback",
|
|
155
|
+
"description": "Provide performance feedback",
|
|
156
|
+
"inputSchema": {
|
|
157
|
+
"type": "object",
|
|
158
|
+
"properties": {
|
|
159
|
+
"media_buy_id": {"type": "string"},
|
|
160
|
+
"feedback": {"type": "object"},
|
|
161
|
+
},
|
|
162
|
+
"required": ["media_buy_id", "feedback"],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
# V3 Protocol Discovery
|
|
166
|
+
{
|
|
167
|
+
"name": "get_adcp_capabilities",
|
|
168
|
+
"description": "Get ADCP capabilities supported by this agent",
|
|
169
|
+
"inputSchema": {
|
|
170
|
+
"type": "object",
|
|
171
|
+
"properties": {},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
# V3 Content Standards
|
|
175
|
+
{
|
|
176
|
+
"name": "create_content_standards",
|
|
177
|
+
"description": "Create content standards configuration",
|
|
178
|
+
"inputSchema": {
|
|
179
|
+
"type": "object",
|
|
180
|
+
"properties": {
|
|
181
|
+
"name": {"type": "string"},
|
|
182
|
+
"rules": {"type": "array"},
|
|
183
|
+
},
|
|
184
|
+
"required": ["name"],
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "get_content_standards",
|
|
189
|
+
"description": "Get content standards configuration",
|
|
190
|
+
"inputSchema": {
|
|
191
|
+
"type": "object",
|
|
192
|
+
"properties": {
|
|
193
|
+
"content_standards_id": {"type": "string"},
|
|
194
|
+
},
|
|
195
|
+
"required": ["content_standards_id"],
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "list_content_standards",
|
|
200
|
+
"description": "List content standards configurations",
|
|
201
|
+
"inputSchema": {
|
|
202
|
+
"type": "object",
|
|
203
|
+
"properties": {
|
|
204
|
+
"pagination": {"type": "object"},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"name": "update_content_standards",
|
|
210
|
+
"description": "Update content standards configuration",
|
|
211
|
+
"inputSchema": {
|
|
212
|
+
"type": "object",
|
|
213
|
+
"properties": {
|
|
214
|
+
"content_standards_id": {"type": "string"},
|
|
215
|
+
"rules": {"type": "array"},
|
|
216
|
+
},
|
|
217
|
+
"required": ["content_standards_id"],
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"name": "calibrate_content",
|
|
222
|
+
"description": "Calibrate content against standards",
|
|
223
|
+
"inputSchema": {
|
|
224
|
+
"type": "object",
|
|
225
|
+
"properties": {
|
|
226
|
+
"content_standards_id": {"type": "string"},
|
|
227
|
+
"content": {"type": "object"},
|
|
228
|
+
},
|
|
229
|
+
"required": ["content_standards_id", "content"],
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"name": "validate_content_delivery",
|
|
234
|
+
"description": "Validate content delivery against standards",
|
|
235
|
+
"inputSchema": {
|
|
236
|
+
"type": "object",
|
|
237
|
+
"properties": {
|
|
238
|
+
"content_standards_id": {"type": "string"},
|
|
239
|
+
"delivery": {"type": "object"},
|
|
240
|
+
},
|
|
241
|
+
"required": ["content_standards_id", "delivery"],
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"name": "get_media_buy_artifacts",
|
|
246
|
+
"description": "Get artifacts associated with a media buy",
|
|
247
|
+
"inputSchema": {
|
|
248
|
+
"type": "object",
|
|
249
|
+
"properties": {
|
|
250
|
+
"media_buy_id": {"type": "string"},
|
|
251
|
+
},
|
|
252
|
+
"required": ["media_buy_id"],
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
# V3 Sponsored Intelligence
|
|
256
|
+
{
|
|
257
|
+
"name": "si_get_offering",
|
|
258
|
+
"description": "Get sponsored intelligence offering",
|
|
259
|
+
"inputSchema": {
|
|
260
|
+
"type": "object",
|
|
261
|
+
"properties": {},
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"name": "si_initiate_session",
|
|
266
|
+
"description": "Initiate sponsored intelligence session",
|
|
267
|
+
"inputSchema": {
|
|
268
|
+
"type": "object",
|
|
269
|
+
"properties": {
|
|
270
|
+
"topic": {"type": "string"},
|
|
271
|
+
"budget": {"type": "number"},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"name": "si_send_message",
|
|
277
|
+
"description": "Send message in sponsored intelligence session",
|
|
278
|
+
"inputSchema": {
|
|
279
|
+
"type": "object",
|
|
280
|
+
"properties": {
|
|
281
|
+
"session_id": {"type": "string"},
|
|
282
|
+
"message": {"type": "string"},
|
|
283
|
+
},
|
|
284
|
+
"required": ["session_id", "message"],
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"name": "si_terminate_session",
|
|
289
|
+
"description": "Terminate sponsored intelligence session",
|
|
290
|
+
"inputSchema": {
|
|
291
|
+
"type": "object",
|
|
292
|
+
"properties": {
|
|
293
|
+
"session_id": {"type": "string"},
|
|
294
|
+
},
|
|
295
|
+
"required": ["session_id"],
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
# V3 Governance (Property Lists)
|
|
299
|
+
{
|
|
300
|
+
"name": "create_property_list",
|
|
301
|
+
"description": "Create a property list for governance filtering",
|
|
302
|
+
"inputSchema": {
|
|
303
|
+
"type": "object",
|
|
304
|
+
"properties": {
|
|
305
|
+
"name": {"type": "string"},
|
|
306
|
+
"description": {"type": "string"},
|
|
307
|
+
"base_properties": {"type": "array"},
|
|
308
|
+
"filters": {"type": "object"},
|
|
309
|
+
"brand_manifest": {"type": "object"},
|
|
310
|
+
},
|
|
311
|
+
"required": ["name"],
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"name": "get_property_list",
|
|
316
|
+
"description": "Get a property list with optional resolution",
|
|
317
|
+
"inputSchema": {
|
|
318
|
+
"type": "object",
|
|
319
|
+
"properties": {
|
|
320
|
+
"list_id": {"type": "string"},
|
|
321
|
+
"resolve": {"type": "boolean"},
|
|
322
|
+
"pagination": {"type": "object"},
|
|
323
|
+
},
|
|
324
|
+
"required": ["list_id"],
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"name": "list_property_lists",
|
|
329
|
+
"description": "List property lists",
|
|
330
|
+
"inputSchema": {
|
|
331
|
+
"type": "object",
|
|
332
|
+
"properties": {
|
|
333
|
+
"principal": {"type": "string"},
|
|
334
|
+
"pagination": {"type": "object"},
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"name": "update_property_list",
|
|
340
|
+
"description": "Update a property list",
|
|
341
|
+
"inputSchema": {
|
|
342
|
+
"type": "object",
|
|
343
|
+
"properties": {
|
|
344
|
+
"list_id": {"type": "string"},
|
|
345
|
+
"name": {"type": "string"},
|
|
346
|
+
"description": {"type": "string"},
|
|
347
|
+
"filters": {"type": "object"},
|
|
348
|
+
"brand_manifest": {"type": "object"},
|
|
349
|
+
},
|
|
350
|
+
"required": ["list_id"],
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"name": "delete_property_list",
|
|
355
|
+
"description": "Delete a property list",
|
|
356
|
+
"inputSchema": {
|
|
357
|
+
"type": "object",
|
|
358
|
+
"properties": {
|
|
359
|
+
"list_id": {"type": "string"},
|
|
360
|
+
},
|
|
361
|
+
"required": ["list_id"],
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
]
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
def create_tool_caller(
|
|
368
|
+
handler: ADCPHandler,
|
|
369
|
+
method_name: str,
|
|
370
|
+
) -> Callable[[dict[str, Any]], Any]:
|
|
371
|
+
"""Create a tool caller function for an ADCP handler method.
|
|
372
|
+
|
|
373
|
+
Args:
|
|
374
|
+
handler: The ADCP handler instance
|
|
375
|
+
method_name: Name of the method to call
|
|
376
|
+
|
|
377
|
+
Returns:
|
|
378
|
+
Async callable that invokes the handler method
|
|
379
|
+
"""
|
|
380
|
+
method = getattr(handler, method_name)
|
|
381
|
+
|
|
382
|
+
async def call_tool(params: dict[str, Any]) -> Any:
|
|
383
|
+
context = ToolContext()
|
|
384
|
+
result = await method(params, context)
|
|
385
|
+
# Convert Pydantic models to dicts for MCP serialization
|
|
386
|
+
if hasattr(result, "model_dump"):
|
|
387
|
+
return result.model_dump(exclude_none=True)
|
|
388
|
+
return result
|
|
389
|
+
|
|
390
|
+
return call_tool
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
class MCPToolSet:
|
|
394
|
+
"""Collection of MCP tools from an ADCP handler.
|
|
395
|
+
|
|
396
|
+
Provides tool definitions and handlers for registering with an MCP server.
|
|
397
|
+
"""
|
|
398
|
+
|
|
399
|
+
def __init__(self, handler: ADCPHandler):
|
|
400
|
+
"""Create tool set from handler.
|
|
401
|
+
|
|
402
|
+
Args:
|
|
403
|
+
handler: ADCP handler instance
|
|
404
|
+
"""
|
|
405
|
+
self.handler = handler
|
|
406
|
+
self._tools: dict[str, Callable[[dict[str, Any]], Any]] = {}
|
|
407
|
+
|
|
408
|
+
# Create tool callers for all methods
|
|
409
|
+
for tool_def in ADCP_TOOL_DEFINITIONS:
|
|
410
|
+
name = tool_def["name"]
|
|
411
|
+
self._tools[name] = create_tool_caller(handler, name)
|
|
412
|
+
|
|
413
|
+
@property
|
|
414
|
+
def tool_definitions(self) -> list[dict[str, Any]]:
|
|
415
|
+
"""Get MCP tool definitions."""
|
|
416
|
+
return ADCP_TOOL_DEFINITIONS.copy()
|
|
417
|
+
|
|
418
|
+
async def call_tool(self, name: str, params: dict[str, Any]) -> Any:
|
|
419
|
+
"""Call a tool by name.
|
|
420
|
+
|
|
421
|
+
Args:
|
|
422
|
+
name: Tool name
|
|
423
|
+
params: Tool parameters
|
|
424
|
+
|
|
425
|
+
Returns:
|
|
426
|
+
Tool result
|
|
427
|
+
|
|
428
|
+
Raises:
|
|
429
|
+
KeyError: If tool not found
|
|
430
|
+
"""
|
|
431
|
+
if name not in self._tools:
|
|
432
|
+
raise KeyError(f"Unknown tool: {name}")
|
|
433
|
+
return await self._tools[name](params)
|
|
434
|
+
|
|
435
|
+
def get_tool_names(self) -> list[str]:
|
|
436
|
+
"""Get list of available tool names."""
|
|
437
|
+
return list(self._tools.keys())
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
def create_mcp_tools(handler: ADCPHandler) -> MCPToolSet:
|
|
441
|
+
"""Create MCP tools from an ADCP handler.
|
|
442
|
+
|
|
443
|
+
This is the main entry point for MCP server integration.
|
|
444
|
+
|
|
445
|
+
Example with mcp library:
|
|
446
|
+
from mcp.server import Server
|
|
447
|
+
from adcp.server import ContentStandardsHandler, create_mcp_tools
|
|
448
|
+
|
|
449
|
+
class MyHandler(ContentStandardsHandler):
|
|
450
|
+
# ... implement methods
|
|
451
|
+
|
|
452
|
+
handler = MyHandler()
|
|
453
|
+
tools = create_mcp_tools(handler)
|
|
454
|
+
|
|
455
|
+
server = Server("my-content-agent")
|
|
456
|
+
|
|
457
|
+
@server.list_tools()
|
|
458
|
+
async def list_tools():
|
|
459
|
+
return tools.tool_definitions
|
|
460
|
+
|
|
461
|
+
@server.call_tool()
|
|
462
|
+
async def call_tool(name: str, arguments: dict):
|
|
463
|
+
return await tools.call_tool(name, arguments)
|
|
464
|
+
|
|
465
|
+
Args:
|
|
466
|
+
handler: ADCP handler instance
|
|
467
|
+
|
|
468
|
+
Returns:
|
|
469
|
+
MCPToolSet with tool definitions and handlers
|
|
470
|
+
"""
|
|
471
|
+
return MCPToolSet(handler)
|