scalekit-sdk-python 2.25.0__py3-none-any.whl → 2.26.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.
scalekit/_version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  # Single source of truth for the SDK version.
2
2
  # Import this in setup.py and scalekit/core.py — never hardcode the version elsewhere.
3
- __version__ = "2.25.0"
3
+ __version__ = "2.26.0"
@@ -16,6 +16,7 @@ from scalekit.actions.types import ToolRequest,ExecuteToolResponse,MagicLinkResp
16
16
  McpConfig,McpConfigConnectionToolMapping,VerifyConnectedAccountUserResponse, \
17
17
  CreateCustomProviderRequest,UpdateCustomProviderRequest,ListProvidersRequest,DeleteCustomProviderRequest, \
18
18
  CreateCustomProviderResponse,UpdateCustomProviderResponse,ListProvidersResponse,DeleteCustomProviderResponse, \
19
+ ToolCollectionRun, \
19
20
  ListMcpConnectedAccountsResponse,CreateMcpSessionTokenResponse,McpConnectionAuthState
20
21
  from scalekit.actions.models.responses.create_connected_account_response import CreateConnectedAccountResponse
21
22
  from scalekit.actions.models.requests.create_connected_account_request import CreateConnectedAccountRequest
@@ -29,7 +30,12 @@ from scalekit.common.exceptions import ScalekitNotFoundException
29
30
  from scalekit.actions.triggers import ActionTriggers
30
31
  from scalekit.triggers import TriggersClient
31
32
  from scalekit.mcp import _check_connection_token_args
32
- from scalekit.v1.tools.tools_pb2 import Filter, ScopedToolFilter
33
+ from scalekit.v1.providers.providers_pb2 import (
34
+ GetToolCollectionRunRequest as GetToolCollectionRunProtoRequest,
35
+ TriggerToolCollectionRequest as TriggerToolCollectionProtoRequest,
36
+ )
37
+ from scalekit.v1.providers.providers_pb2_grpc import ProviderServiceStub
38
+ from scalekit.v1.tools.tools_pb2 import DeleteCustomToolRequest, Filter, ScopedToolFilter
33
39
  from scalekit.actions.models.responses.tool_discovery_responses import (
34
40
  ListScopedToolsResponse, ListAvailableToolsResponse, SearchToolsResponse,
35
41
  )
@@ -75,6 +81,7 @@ class ActionClient:
75
81
  self._mcp_actions = None
76
82
  self._providers_client = providers_client
77
83
  self._providers_actions = None
84
+ self._provider_stub: ProviderServiceStub | None = None
78
85
  self._triggers_client = triggers_client
79
86
  self._triggers_actions: ActionTriggers | None = None
80
87
  self._modifiers: List[Modifier] = []
@@ -171,6 +178,10 @@ class ActionClient:
171
178
  """
172
179
  Execute a tool with the given parameters.
173
180
 
181
+ A custom connector's tools run like any other: ``a-<connector>_<operation>`` for a
182
+ connector created from an OpenAPI spec, ``c-<connector>_<tool>`` for a custom MCP
183
+ connector. Use a connected account of a connection on the tool's own connector.
184
+
174
185
  Args:
175
186
  tool_input: Input data for the tool execution (required)
176
187
  tool_name: Name of the tool to execute (required)
@@ -240,15 +251,33 @@ class ActionClient:
240
251
 
241
252
  Thin wrapper around ToolsClient.list_tools.
242
253
 
243
- :param connection_name: Filter by connector identifier, e.g. 'github-connect' (optional)
254
+ Tools of a custom connector are listed under the names the server gives them:
255
+ ``a-<connector>_<operation>`` for a connector created from an OpenAPI spec, and
256
+ ``c-<connector>_<tool>`` for a custom MCP connector. List an OpenAPI-sourced
257
+ connector's tools with ``provider`` set to the connector's identifier (at most 50
258
+ characters), or with ``connection_name`` set to a connection on it; they are
259
+ shared by every connected account. A custom MCP connector's tools belong to a
260
+ connected account, so pass ``connection_name`` together with ``identifier``, or
261
+ ``connected_account_id``. OpenAPI-sourced tools are not listed where that
262
+ capability is not enabled for the environment.
263
+
264
+ :param connection_name: The connection name, as shown in AgentKit > Connections, e.g.
265
+ 'github-connect'. Alone it does not identify a connected account; add ``identifier``
266
+ (or pass ``connected_account_id``) to include that account's custom MCP tools (optional)
244
267
  :type: str
245
268
  :param identifier: Filter/resolve by connected-account identifier (optional)
246
269
  :type: str
247
- :param provider: Filter by provider key, e.g. 'github' (optional)
270
+ :param provider: The app, such as 'GMAIL', or the identifier of a custom connector,
271
+ e.g. the ``Provider.identifier`` of an OpenAPI-sourced one. At most 50 characters
272
+ (optional)
248
273
  :type: str
249
274
  :param tool_name: Filter to specific tool names (optional)
250
275
  :type: List[str]
251
- :param query: Free-form search query across tool metadata (optional)
276
+ :param query: Search tools by name, 3 to 100 characters (optional). The query is split
277
+ on spaces and underscores and every token must appear in the name, so
278
+ ``"gmail get attachment"`` matches ``gmail_get_attachment``. It searches global
279
+ tools only, so it never returns a custom connector's tools, and a page of results
280
+ holds at most 100 tools.
252
281
  :type: str
253
282
  :param organization_id: Organization ID to scope the connected-account lookup (optional)
254
283
  :type: str
@@ -259,7 +288,9 @@ class ActionClient:
259
288
  :type: str
260
289
  :param summary: Whether to return a summarized tool definition (optional)
261
290
  :type: bool
262
- :param page_size: Maximum number of tools to return per page (optional)
291
+ :param page_size: Maximum number of tools to return per page (optional). The server uses
292
+ 300 when this is omitted or 0, and reduces a value above 1000 to 1000 instead of
293
+ rejecting it
263
294
  :type: int
264
295
  :param page_token: Token from a previous response for pagination (optional)
265
296
  :type: str
@@ -375,6 +406,172 @@ class ActionClient:
375
406
  )
376
407
  return ListAvailableToolsResponse.from_proto(result_tuple[0])
377
408
 
409
+ def delete_custom_tool(self, tool_identifier: str, **kwargs) -> None:
410
+ """
411
+ Delete one tool of a connector created from an OpenAPI spec, by its name or its id.
412
+
413
+ Call it as ``scalekit_client.actions.delete_custom_tool(tool_identifier=...)``.
414
+
415
+ ``tool_identifier`` is the tool's name (``a-<connector>_<operation>``, as ``list_tools``
416
+ lists it) or its id (``tol_<number>``, the ``id`` of each tool that
417
+ ``list_tools(provider=<connector identifier>)`` returns). The server ignores ASCII case,
418
+ and a value that starts with ``tol_`` (in any case) is always read as an id. Leading and
419
+ trailing whitespace is removed; nothing else is changed, so the case is not folded.
420
+
421
+ A tool collection run creates the tool again while its operation is still in the
422
+ connector's spec, unless the spec, base URL and auth patterns are unchanged since the last
423
+ completed run: then it creates nothing (a spec that references external files is always
424
+ regenerated, and so is the run right after a first run that filled in the base URL or the
425
+ OAuth settings). So, apart from those two cases, ``invoke_tool_collection`` alone does not
426
+ restore a deleted tool: change one of those inputs, for example the spec, call it and let
427
+ the run finish. To keep the tool gone, remove its endpoint from the spec.
428
+
429
+ :param tool_identifier: Name or id of the tool to delete (required)
430
+ :type: str
431
+
432
+ :returns:
433
+ None on success
434
+
435
+ :raises ValueError: If tool_identifier is not a string or is blank; nothing is sent
436
+ :raises ScalekitBadRequestException: 400, longer than 2048 characters or a control
437
+ character
438
+ :raises ScalekitForbiddenException: 403, the caller lacks permission to delete
439
+ :raises ScalekitNotFoundException: 404, not a deletable tool (the error does not say why)
440
+ :raises ScalekitConflictException: 409, nothing deleted: RESOURCE_ALREADY_EXISTS while a
441
+ sync of the connector is queued or running (the message names the run), or
442
+ TOOL_NAME_AMBIGUOUS when tools of more than one connector have that name (the
443
+ message names two of them: delete the tool by its id; the id of a tool whose
444
+ connector no longer exists answers 404)
445
+ :raises ScalekitInternalServerException: 500, the server failed; the tool may be gone
446
+ :raises ScalekitNotImplementedException: 501, a backend older than release v0.1.165.0
447
+ does not have the call
448
+
449
+ Example:
450
+ >>> scalekit_client.actions.delete_custom_tool(tool_identifier="a-acmeapi_deletepet")
451
+ """
452
+ if not isinstance(tool_identifier, str) or not tool_identifier.strip():
453
+ raise ValueError("tool_identifier must be a non-empty string to delete a custom tool")
454
+ self.tools.core_client.grpc_exec(
455
+ self.tools.tool_service.DeleteCustomTool.with_call,
456
+ DeleteCustomToolRequest(tool_identifier=tool_identifier.strip()),
457
+ )
458
+
459
+ def _provider_service(self) -> ProviderServiceStub:
460
+ """The ProviderService stub, built on first use from the tools client's channel and kept."""
461
+ if self._provider_stub is None:
462
+ self._provider_stub = ProviderServiceStub(self.tools.core_client.grpc_secure_channel)
463
+ return self._provider_stub
464
+
465
+ def invoke_tool_collection(self, provider_identifier: str, **kwargs) -> ToolCollectionRun:
466
+ """
467
+ Queue a new tool collection run on an OpenAPI-sourced connector.
468
+
469
+ Call it as ``scalekit_client.actions.invoke_tool_collection(provider_identifier=...)``.
470
+
471
+ The server re-fetches and validates the connector's current spec URL, queues a background run
472
+ that regenerates the connector's tools, and returns that run at once with status ``QUEUED``. A
473
+ connector is also re-synced automatically when it is created and when its base URL or spec URL
474
+ changes, so call this to pick up changes to the spec itself or to retry after a failed run. Follow
475
+ the run with ``get_tool_collection_run``. A run that finds the spec, base URL and auth patterns
476
+ unchanged since the last completed run changes nothing, so it does not bring back a tool removed
477
+ with ``delete_custom_tool`` (see that method for the exceptions).
478
+
479
+ :param provider_identifier: The connector's ``identifier`` (``NAME:environment-id``, from
480
+ ``provider.identifier``), not ``provider.id`` (``prvd_...``, which answers 404), such as
481
+ ``ACMEAPI:70219645518265104`` (required). 1 to 255 characters once the whitespace around it is
482
+ removed
483
+ :type provider_identifier: str
484
+
485
+ :returns:
486
+ The queued run, a ``ToolCollectionRun`` with status ``QUEUED``
487
+ :rtype: ToolCollectionRun
488
+
489
+ :raises ValueError: If provider_identifier is not a string, is blank or is longer than 255
490
+ characters; nothing is sent
491
+ :raises ScalekitNotFoundException: 404, no connector with that identifier exists
492
+ :raises ScalekitBadRequestException: 400, the connector is not sourced from an OpenAPI spec, its
493
+ stored spec URL fails validation, or OpenAPI-sourced connectors are not enabled for the
494
+ environment (``FEATURE_NOT_ENABLED``)
495
+ :raises ScalekitConflictException: 409 ``RESOURCE_ALREADY_EXISTS``, a run is already queued or
496
+ running for the connector (a connector has at most one active run): wait for it to finish and
497
+ call again
498
+
499
+ Example:
500
+ >>> run = scalekit_client.actions.invoke_tool_collection(
501
+ ... provider_identifier="ACMEAPI:70219645518265104"
502
+ ... )
503
+ >>> run.status # ToolCollectionRunStatus.QUEUED
504
+ """
505
+ if not isinstance(provider_identifier, str) or not provider_identifier.strip():
506
+ raise ValueError("provider_identifier must be a non-empty string to invoke a tool collection run")
507
+ provider_identifier = provider_identifier.strip()
508
+ if len(provider_identifier) > 255:
509
+ raise ValueError("provider_identifier must be at most 255 characters")
510
+ result_tuple = self.tools.core_client.grpc_exec(
511
+ self._provider_service().TriggerToolCollection.with_call,
512
+ TriggerToolCollectionProtoRequest(provider_identifier=provider_identifier),
513
+ )
514
+ return ToolCollectionRun.from_proto(result_tuple[0])
515
+
516
+ def get_tool_collection_run(
517
+ self, provider_identifier: str, run_id: str = "latest", **kwargs
518
+ ) -> ToolCollectionRun:
519
+ """
520
+ Read one tool collection run of an OpenAPI-sourced connector.
521
+
522
+ Call it as ``scalekit_client.actions.get_tool_collection_run(provider_identifier=...)``.
523
+
524
+ Returns the run's status, its counters (operations found, tools created, updated and deleted) and,
525
+ once the run has finished, the operations it skipped and why. A run moves ``QUEUED``,
526
+ ``PROCESSING``, then ``COMPLETED`` or ``FAILED``; the server marks a run that makes no progress for
527
+ 30 minutes ``FAILED``. Poll until ``run.is_terminal`` is true: ``run.skipped_tools`` then lists the
528
+ operations that could not become tools, and ``run.error_message`` says why a failed run failed.
529
+ ``"latest"`` is looked up again on every call, so it moves on to a newer run if one is queued while
530
+ you poll; to follow one run to its end, pass the ``run_id`` of the run you started or first read.
531
+
532
+ :param provider_identifier: The connector's ``identifier`` (``NAME:environment-id``, from
533
+ ``provider.identifier``), not ``provider.id`` (``prvd_...``, which answers 404), such as
534
+ ``ACMEAPI:70219645518265104`` (required). 1 to 255 characters once the whitespace around it is
535
+ removed
536
+ :type provider_identifier: str
537
+ :param run_id: The ``run_id`` of a ``ToolCollectionRun``, or ``"latest"`` (the default; an empty or
538
+ blank string means the same) for the connector's most recent run, for example the one
539
+ ``create_custom_provider`` queued (optional). At most 255 characters once the whitespace around
540
+ it is removed
541
+ :type run_id: str
542
+
543
+ :returns:
544
+ The run, a ``ToolCollectionRun``
545
+ :rtype: ToolCollectionRun
546
+
547
+ :raises ValueError: If provider_identifier is not a string, is blank or is longer than 255
548
+ characters, or run_id is not a string or is longer than 255 characters; nothing is sent
549
+ :raises ScalekitNotFoundException: 404, the connector does not exist, it has no run yet, or the
550
+ run_id names no run of this connector
551
+ :raises ScalekitBadRequestException: 400, the run_id is not a valid run ID
552
+
553
+ Example:
554
+ >>> run = scalekit_client.actions.get_tool_collection_run(
555
+ ... provider_identifier="ACMEAPI:70219645518265104", run_id="latest"
556
+ ... )
557
+ >>> run.status, run.is_terminal # ask again until run.is_terminal is True
558
+ """
559
+ if not isinstance(provider_identifier, str) or not provider_identifier.strip():
560
+ raise ValueError("provider_identifier must be a non-empty string to read a tool collection run")
561
+ if not isinstance(run_id, str):
562
+ raise ValueError("run_id must be a string")
563
+ provider_identifier = provider_identifier.strip()
564
+ run_id = run_id.strip() or "latest"
565
+ if len(provider_identifier) > 255:
566
+ raise ValueError("provider_identifier must be at most 255 characters")
567
+ if len(run_id) > 255:
568
+ raise ValueError("run_id must be at most 255 characters")
569
+ result_tuple = self.tools.core_client.grpc_exec(
570
+ self._provider_service().GetToolCollectionRun.with_call,
571
+ GetToolCollectionRunProtoRequest(provider_identifier=provider_identifier, run_id=run_id),
572
+ )
573
+ return ToolCollectionRun.from_proto(result_tuple[0])
574
+
378
575
  def search_tools(
379
576
  self,
380
577
  query: str,
@@ -1450,7 +1647,8 @@ class ActionClient:
1450
1647
  Generated when omitted.
1451
1648
  :param auth_mode: ``AuthMode.USER`` (default) or ``AuthMode.ORG_WIDE``. Cannot be changed later.
1452
1649
  :param provider_domain: Only for regional connectors (for example ``"mcp-eu.mixpanel.com"`` for
1453
- MIXPANELMCP). Create-only and never returned.
1650
+ MIXPANELMCP), and for a custom MCP connector whose ``proxy_url`` is a template with a
1651
+ ``{{domain}}`` placeholder: the host name that replaces it. Create-only and never returned.
1454
1652
  :returns: The created connection.
1455
1653
  :raises AgentKitConnectionError: on failure; see ``scalekit.actions.connections.errors``.
1456
1654
 
@@ -1505,6 +1703,10 @@ class ActionClient:
1505
1703
  turns ``use_scalekit_creds`` off unless you set it. A secret echoed back in its masked form is
1506
1704
  ignored.
1507
1705
 
1706
+ To choose how Scalekit sends client credentials to the provider's token URL, pass
1707
+ ``oauth=OAuthSettings(token_endpoint_auth_method=TokenEndpointAuthMethod.BASIC_AUTH)``; see
1708
+ ``TokenEndpointAuthMethod`` for the values.
1709
+
1508
1710
  :raises AgentKitConnectionError: on failure; see ``scalekit.actions.connections.errors``.
1509
1711
  """
1510
1712
  return self._connection_actions().update_connection(
@@ -2073,26 +2275,46 @@ class ActionProviders:
2073
2275
  ) -> CreateCustomProviderResponse:
2074
2276
  """Create a new custom provider.
2075
2277
 
2278
+ The connector is sourced from an MCP server (``proxy_url``) or from an OpenAPI
2279
+ spec (``openapi_spec_url``): set exactly one. For an OpenAPI-sourced connector the
2280
+ server validates the spec before it stores anything, returns at once, and
2281
+ generates the tools in an asynchronous tool collection run that it queues for
2282
+ you. Follow it with ``scalekit_client.actions.get_tool_collection_run``.
2283
+
2076
2284
  :param request: Request object containing display_name (required),
2077
- proxy_url (required), and optional description,
2078
- proxy_enabled, auth_patterns, icon_src, and metadata.
2285
+ exactly one of proxy_url and openapi_spec_url, and
2286
+ auth_patterns (one AuthPattern, required in practice: the
2287
+ server rejects a missing or empty list), plus optional
2288
+ description, icon_src, and metadata.
2079
2289
  :type request: CreateCustomProviderRequest
2080
2290
 
2081
2291
  :returns: Response containing the created provider with its server-assigned
2082
- identifier and all decoded auth_patterns.
2292
+ identifier and all decoded auth_patterns. Pass the identifier as
2293
+ ``provider`` to ``scalekit_client.actions.create_connection`` to create a
2294
+ connection to this connector.
2083
2295
  :rtype: CreateCustomProviderResponse
2084
2296
 
2085
- :raises ScalekitBadRequestException: If required fields are missing or invalid.
2086
- :raises ScalekitConflictException: If a provider with the same name already exists.
2297
+ :raises ScalekitBadRequestException: 400, if a required field is missing or invalid
2298
+ (``INVALID_ARGUMENT``), auth_patterns is missing or empty, or the display_name
2299
+ is the name of a built-in login provider (Github, Google, Gitlab, Microsoft,
2300
+ LinkedIn, Salesforce, Facebook); the message shows the field and the reason.
2301
+ Also a spec URL that cannot be fetched or is not a valid OpenAPI or Swagger
2302
+ document, or OpenAPI-sourced connectors not enabled for the environment
2303
+ (``FEATURE_NOT_ENABLED``).
2304
+ :raises ScalekitConflictException: 409, if an OpenAPI connector with the same name
2305
+ already exists in the environment (``RESOURCE_ALREADY_EXISTS``). For any other
2306
+ connector a name that is already in use does not raise: the new provider gets a
2307
+ numbered identifier. A create that races another create with the same name can
2308
+ also raise it.
2087
2309
  """
2088
2310
  result_tuple = self._providers_client.create_custom_provider(
2089
2311
  display_name=request.display_name,
2090
2312
  proxy_url=request.proxy_url,
2091
- proxy_enabled=request.proxy_enabled,
2092
2313
  description=request.description,
2093
2314
  auth_patterns=request.auth_patterns,
2094
2315
  icon_src=request.icon_src,
2095
2316
  metadata=request.metadata,
2317
+ openapi_spec_url=request.openapi_spec_url,
2096
2318
  )
2097
2319
  return CreateCustomProviderResponse.from_proto(result_tuple[0])
2098
2320
 
@@ -2102,19 +2324,44 @@ class ActionProviders:
2102
2324
  ) -> UpdateCustomProviderResponse:
2103
2325
  """Update an existing custom provider.
2104
2326
 
2105
- Only fields set to a non-None value in the request are applied.
2106
- Fields left as None are ignored and their existing server values are kept.
2107
-
2108
- :param request: Request object containing identifier (required) and any
2109
- combination of display_name, description, proxy_url,
2110
- auth_patterns, icon_src, and metadata to update.
2327
+ The server applies this as a PUT, not a partial update. It requires
2328
+ display_name and auth_patterns on every update, and proxy_url as well for an
2329
+ MCP-sourced connector. Fields left as None are not sent: description and icon_src
2330
+ keep their stored values, but metadata is cleared.
2331
+
2332
+ An OpenAPI-sourced connector can only change display_name, description,
2333
+ icon_src, metadata and proxy_url (its base URL), and openapi_spec_url where the
2334
+ workspace has that capability enabled. Changing the base URL saves it
2335
+ and queues a tool collection run that regenerates every tool. Changing
2336
+ auth_patterns is rejected, and a value counts as changed only
2337
+ when it differs from the stored one, so send them back exactly as
2338
+ ``list_providers`` returned them: a decoded ``AuthPattern`` that you leave
2339
+ unchanged is sent as the server returned it. See ``UpdateCustomProviderRequest``.
2340
+
2341
+ :param request: Request object containing identifier, display_name and
2342
+ auth_patterns (required), and any combination of proxy_url,
2343
+ openapi_spec_url, description, icon_src and metadata.
2111
2344
  :type request: UpdateCustomProviderRequest
2112
2345
 
2113
2346
  :returns: Response containing the provider's full state after the update.
2114
2347
  :rtype: UpdateCustomProviderResponse
2115
2348
 
2116
- :raises ScalekitNotFoundException: If no provider with the given identifier exists.
2117
- :raises ScalekitBadRequestException: If any updated field value is invalid.
2349
+ :raises ScalekitNotFoundException: 404, if no provider with the given identifier exists.
2350
+ :raises ScalekitBadRequestException: 400, if any updated field value is invalid
2351
+ (``INVALID_ARGUMENT``), if the auth type or the connector kind (MCP or API)
2352
+ differs from the existing provider, if an API_KEY provider switches between
2353
+ single-key and multiple-headers mode, if a locked field of an OpenAPI-sourced
2354
+ connector changed, if changing ``openapi_spec_url`` is not enabled for the workspace
2355
+ (``FEATURE_NOT_ENABLED``), or if the base URL (``proxy_url``) of an
2356
+ OpenAPI-sourced connector changes where OpenAPI-sourced connectors are not
2357
+ enabled for the environment (``FEATURE_NOT_ENABLED``, nothing is saved).
2358
+ :raises ScalekitConflictException: 409, if a changed base URL or spec URL was saved but
2359
+ its tool collection run could not be queued because another run is in
2360
+ progress (``RESOURCE_ALREADY_EXISTS``); call
2361
+ ``scalekit_client.actions.invoke_tool_collection`` once that run completes.
2362
+ :raises ScalekitInternalServerException: 500, if a changed base URL or spec URL was saved
2363
+ but its tool collection run could not be queued for another reason; call
2364
+ ``scalekit_client.actions.invoke_tool_collection`` to retry.
2118
2365
  """
2119
2366
  result_tuple = self._providers_client.update_custom_provider(
2120
2367
  identifier=request.identifier,
@@ -2124,6 +2371,7 @@ class ActionProviders:
2124
2371
  auth_patterns=request.auth_patterns,
2125
2372
  icon_src=request.icon_src,
2126
2373
  metadata=request.metadata,
2374
+ openapi_spec_url=request.openapi_spec_url,
2127
2375
  )
2128
2376
  return UpdateCustomProviderResponse.from_proto(result_tuple[0])
2129
2377
 
@@ -2159,8 +2407,22 @@ class ActionProviders:
2159
2407
  """Delete a custom provider by identifier.
2160
2408
 
2161
2409
  Deletion is permanent. Returns an empty response on success. Any error
2162
- (provider not found, insufficient permissions) raises a
2163
- ScalekitServerException subclass before this method returns.
2410
+ (provider not found, insufficient permissions, provider still has
2411
+ connections) raises a ScalekitServerException subclass before this method
2412
+ returns. Deleting also removes the provider's discovered custom MCP tools.
2413
+
2414
+ A connector that still has connections is not deleted: the call raises
2415
+ ScalekitBadRequestException (400, PROVIDER_HAS_EXISTING_CONNECTIONS); delete its
2416
+ connections first. The server checks this before the run described next.
2417
+
2418
+ For a connector created from an OpenAPI spec: while a tool collection run of
2419
+ the connector is queued or processing (the server's message calls it an
2420
+ ingestion run), nothing is deleted: the call raises ScalekitConflictException
2421
+ (409, RESOURCE_ALREADY_EXISTS) and the message names the run. Poll that run
2422
+ with ``scalekit_client.actions.get_tool_collection_run`` (pass its ID as
2423
+ run_id) and retry once it has finished; the server fails a run that makes no
2424
+ progress after about 30 minutes. An MCP or plain REST connector has no run to
2425
+ wait for.
2164
2426
 
2165
2427
  :param request: Request object containing the identifier of the provider
2166
2428
  to delete.
@@ -2169,8 +2431,15 @@ class ActionProviders:
2169
2431
  :returns: Empty response confirming deletion.
2170
2432
  :rtype: DeleteCustomProviderResponse
2171
2433
 
2172
- :raises ScalekitNotFoundException: If no provider with the given identifier exists.
2173
- :raises ScalekitForbiddenException: If the caller lacks permission to delete.
2434
+ :raises ScalekitNotFoundException: 404, if no provider with the given identifier exists.
2435
+ :raises ScalekitForbiddenException: 403, if the caller lacks permission to delete.
2436
+ :raises ScalekitBadRequestException: 400 (PROVIDER_HAS_EXISTING_CONNECTIONS), if the
2437
+ connector still has connections; nothing is deleted. Remove its connected accounts
2438
+ first, then its connections with ``scalekit_client.actions.delete_connection`` (a
2439
+ connection that still has connected accounts cannot be deleted either).
2440
+ :raises ScalekitConflictException: 409 (RESOURCE_ALREADY_EXISTS), if a tool collection
2441
+ run of a connector created from an OpenAPI spec is queued or processing; nothing is
2442
+ deleted.
2174
2443
  """
2175
2444
  result_tuple = self._providers_client.delete_custom_provider(request.identifier)
2176
2445
  return DeleteCustomProviderResponse.from_proto(result_tuple[0])
@@ -26,12 +26,25 @@ class AuthMode(str, Enum):
26
26
 
27
27
 
28
28
  class TokenEndpointAuthMethod(str, Enum):
29
- """How Scalekit authenticates to the provider's token endpoint."""
29
+ """How Scalekit sends client credentials to the provider's token URL.
30
+
31
+ Set it with ``update_connection(oauth=OAuthSettings(token_endpoint_auth_method=...))``. Choose the
32
+ value the provider's documentation requires for its token URL, and use ``DEFAULT``, which lets
33
+ Scalekit choose, only when you cannot find a concrete one: a wrong value makes new authorizations
34
+ fail and, on an MCP or OAUTH_M2M connection, token refresh too, so those connected accounts have to
35
+ authenticate again. It applies to the authorization_code exchange, MCP token refresh and OAUTH_M2M
36
+ client_credentials; refreshing a token on a non-MCP OAuth connection always detects the method
37
+ itself. When the server reports no method for a connection, the connection you read back has
38
+ ``oauth.token_endpoint_auth_method`` ``None``.
39
+ """
30
40
 
41
+ # public (PKCE) clients: sends no client secret on an MCP token refresh, and on the
42
+ # authorization_code exchange only when the connection has no client secret stored (a stored
43
+ # secret is still sent); OAUTH_M2M client_credentials treats it like BASIC_AUTH
31
44
  NONE = "NONE"
32
- BASIC_AUTH = "BASIC_AUTH" # client_secret_basic
33
- REQUEST_BODY = "REQUEST_BODY" # client_secret_post
34
- DEFAULT = "DEFAULT" # clears the stored value and lets the platform pick
45
+ BASIC_AUTH = "BASIC_AUTH" # client_id and client_secret in a Basic Authorization header (client_secret_basic)
46
+ REQUEST_BODY = "REQUEST_BODY" # client_id and client_secret as POST body parameters (client_secret_post)
47
+ DEFAULT = "DEFAULT" # clears the stored value, so Scalekit chooses: POST body parameters on the authorization_code exchange, a Basic header on an MCP token refresh and OAUTH_M2M client_credentials
35
48
 
36
49
 
37
50
  class _Input(BaseModel):
@@ -91,7 +104,7 @@ class ProviderConfigurations(_Input):
91
104
  to ``update_connection`` is refused by the server (``InvalidConfigurationError``).
92
105
  """
93
106
 
94
- provider_domain: Optional[str] = None # regional connectors only; never returned
107
+ provider_domain: Optional[str] = None # MCP connectors whose URL has {{domain}}; create only; never returned
95
108
  slack_connection_type: Optional[str] = None # "BOT" or "USER"
96
109
  googleads_developer_token: Optional[str] = None # masked; cannot be cleared once set
97
110
  microsoft_tenant_id: Optional[str] = None