airbyte-agent-stripe 0.5.28__py3-none-any.whl → 0.5.32__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.
@@ -65,8 +65,9 @@ class Schema(BaseModel):
65
65
  write_only: Optional[bool] = Field(None, alias="writeOnly")
66
66
  deprecated: Optional[bool] = None
67
67
 
68
- # Airbyte extension
68
+ # Airbyte extensions
69
69
  x_airbyte_entity_name: Optional[str] = Field(None, alias="x-airbyte-entity-name")
70
+ x_airbyte_stream_name: Optional[str] = Field(None, alias="x-airbyte-stream-name")
70
71
 
71
72
 
72
73
  class Parameter(BaseModel):
@@ -77,6 +77,10 @@ class AuthConfigOption(BaseModel):
77
77
  default_factory=dict,
78
78
  description="Mapping from auth parameters (e.g., 'username', 'password', 'token') to template strings using ${field} syntax",
79
79
  )
80
+ replication_auth_key_mapping: Optional[Dict[str, str]] = Field(
81
+ None,
82
+ description="Mapping from source config paths (e.g., 'credentials.api_key') to auth config keys for direct connectors",
83
+ )
80
84
 
81
85
 
82
86
  class AirbyteAuthConfig(BaseModel):
@@ -99,6 +103,12 @@ class AirbyteAuthConfig(BaseModel):
99
103
  properties: Optional[Dict[str, AuthConfigFieldSpec]] = None
100
104
  auth_mapping: Optional[Dict[str, str]] = None
101
105
 
106
+ # Replication connector auth mapping
107
+ replication_auth_key_mapping: Optional[Dict[str, str]] = Field(
108
+ None,
109
+ description="Mapping from source config paths (e.g., 'credentials.api_key') to auth config keys for direct connectors",
110
+ )
111
+
102
112
  # Multiple options (oneOf)
103
113
  one_of: Optional[List[AuthConfigOption]] = Field(None, alias="oneOf")
104
114
 
@@ -221,6 +221,10 @@ class EntityDefinition(BaseModel):
221
221
  model_config = {"populate_by_name": True}
222
222
 
223
223
  name: str
224
+ stream_name: str | None = Field(
225
+ default=None,
226
+ description="Airbyte stream name for cache lookup (from x-airbyte-stream-name schema extension)",
227
+ )
224
228
  actions: list[Action]
225
229
  endpoints: dict[Action, EndpointDefinition]
226
230
  entity_schema: dict[str, Any] | None = Field(default=None, alias="schema")
@@ -4,14 +4,15 @@ stripe connector.
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
- from typing import TYPE_CHECKING, Any, overload
7
+ import logging
8
+ from typing import TYPE_CHECKING, Any, Callable, TypeVar, overload
8
9
  try:
9
10
  from typing import Literal
10
11
  except ImportError:
11
12
  from typing_extensions import Literal
12
13
 
13
14
  from .connector_model import StripeConnectorModel
14
-
15
+ from ._vendored.connector_sdk.introspection import describe_entities, generate_tool_description
15
16
  from .types import (
16
17
  BalanceGetParams,
17
18
  BalanceTransactionsGetParams,
@@ -55,7 +56,6 @@ from .types import (
55
56
  SubscriptionsListParamsCurrentPeriodStart,
56
57
  SubscriptionsSearchParams,
57
58
  )
58
-
59
59
  if TYPE_CHECKING:
60
60
  from .models import StripeAuthConfig
61
61
  # Import response models and envelope models at runtime
@@ -91,6 +91,9 @@ from .models import (
91
91
  SubscriptionSearchResult,
92
92
  )
93
93
 
94
+ # TypeVar for decorator type preservation
95
+ _F = TypeVar("_F", bound=Callable[..., Any])
96
+
94
97
 
95
98
  class StripeConnector:
96
99
  """
@@ -544,6 +547,88 @@ class StripeConnector:
544
547
  # No extractors - return raw response data
545
548
  return result.data
546
549
 
550
+ # ===== INTROSPECTION METHODS =====
551
+
552
+ @classmethod
553
+ def describe(cls, func: _F) -> _F:
554
+ """
555
+ Decorator that populates a function's docstring with connector capabilities.
556
+
557
+ This class method can be used as a decorator to automatically generate
558
+ comprehensive documentation for AI tool functions.
559
+
560
+ Usage:
561
+ @mcp.tool()
562
+ @StripeConnector.describe
563
+ async def execute(entity: str, action: str, params: dict):
564
+ '''Execute operations.'''
565
+ ...
566
+
567
+ The decorated function's __doc__ will be updated with:
568
+ - Available entities and their actions
569
+ - Parameter signatures with required (*) and optional (?) markers
570
+ - Response structure documentation
571
+ - Example questions (if available in OpenAPI spec)
572
+
573
+ Args:
574
+ func: The function to decorate
575
+
576
+ Returns:
577
+ The same function with updated __doc__
578
+ """
579
+ description = generate_tool_description(StripeConnectorModel)
580
+
581
+ original_doc = func.__doc__ or ""
582
+ if original_doc.strip():
583
+ func.__doc__ = f"{original_doc.strip()}\n\n{description}"
584
+ else:
585
+ func.__doc__ = description
586
+
587
+ return func
588
+
589
+ def list_entities(self) -> list[dict[str, Any]]:
590
+ """
591
+ Get structured data about available entities, actions, and parameters.
592
+
593
+ Returns a list of entity descriptions with:
594
+ - entity_name: Name of the entity (e.g., "contacts", "deals")
595
+ - description: Entity description from the first endpoint
596
+ - available_actions: List of actions (e.g., ["list", "get", "create"])
597
+ - parameters: Dict mapping action -> list of parameter dicts
598
+
599
+ Example:
600
+ entities = connector.list_entities()
601
+ for entity in entities:
602
+ print(f"{entity['entity_name']}: {entity['available_actions']}")
603
+ """
604
+ return describe_entities(StripeConnectorModel)
605
+
606
+ def entity_schema(self, entity: str) -> dict[str, Any] | None:
607
+ """
608
+ Get the JSON schema for an entity.
609
+
610
+ Args:
611
+ entity: Entity name (e.g., "contacts", "companies")
612
+
613
+ Returns:
614
+ JSON schema dict describing the entity structure, or None if not found.
615
+
616
+ Example:
617
+ schema = connector.entity_schema("contacts")
618
+ if schema:
619
+ print(f"Contact properties: {list(schema.get('properties', {}).keys())}")
620
+ """
621
+ entity_def = next(
622
+ (e for e in StripeConnectorModel.entities if e.name == entity),
623
+ None
624
+ )
625
+ if entity_def is None:
626
+ logging.getLogger(__name__).warning(
627
+ f"Entity '{entity}' not found. Available entities: "
628
+ f"{[e.name for e in StripeConnectorModel.entities]}"
629
+ )
630
+ return entity_def.entity_schema if entity_def else None
631
+
547
632
 
548
633
 
549
634
  class CustomersQuery: