Skip to content

Commit 2ea8876

Browse files
feat(mcp): Add job_type filtering support to list_cloud_sync_jobs (#974)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 8418815 commit 2ea8876

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

airbyte/_util/api_util.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ def get_job_logs( # noqa: PLR0913 # Too many arguments - needed for auth flexi
587587
bearer_token: SecretString | None,
588588
offset: int | None = None,
589589
order_by: str | None = None,
590+
job_type: models.JobTypeEnum | None = None,
590591
) -> list[models.JobResponse]:
591592
"""Get a list of jobs for a connection.
592593
@@ -600,6 +601,8 @@ def get_job_logs( # noqa: PLR0913 # Too many arguments - needed for auth flexi
600601
bearer_token: Bearer token for authentication (alternative to client credentials).
601602
offset: Number of jobs to skip from the beginning. Defaults to None (0).
602603
order_by: Field and direction to order by (e.g., "createdAt|DESC"). Defaults to None.
604+
job_type: Filter by job type (e.g., JobTypeEnum.SYNC, JobTypeEnum.REFRESH).
605+
If not specified, defaults to sync and reset jobs only (API default behavior).
603606
604607
Returns:
605608
A list of JobResponse objects.
@@ -617,6 +620,7 @@ def get_job_logs( # noqa: PLR0913 # Too many arguments - needed for auth flexi
617620
limit=limit,
618621
offset=offset,
619622
order_by=order_by,
623+
job_type=job_type,
620624
),
621625
)
622626
if status_ok(response.status_code) and response.jobs_response:

airbyte/cloud/connections.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
if TYPE_CHECKING:
15-
from airbyte_api.models import ConnectionResponse, JobResponse
15+
from airbyte_api.models import ConnectionResponse, JobResponse, JobTypeEnum
1616

1717
from airbyte.cloud.workspaces import CloudWorkspace
1818

@@ -291,6 +291,7 @@ def get_previous_sync_logs(
291291
limit: int = 20,
292292
offset: int | None = None,
293293
from_tail: bool = True,
294+
job_type: JobTypeEnum | None = None,
294295
) -> list[SyncResult]:
295296
"""Get previous sync jobs for a connection with pagination support.
296297
@@ -304,6 +305,8 @@ def get_previous_sync_logs(
304305
from_tail: If True, returns jobs ordered newest-first (createdAt DESC).
305306
If False, returns jobs ordered oldest-first (createdAt ASC).
306307
Defaults to True.
308+
job_type: Filter by job type (e.g., JobTypeEnum.SYNC, JobTypeEnum.REFRESH).
309+
If not specified, defaults to sync and reset jobs only (API default behavior).
307310
308311
Returns:
309312
A list of SyncResult objects representing the sync jobs.
@@ -320,6 +323,7 @@ def get_previous_sync_logs(
320323
limit=limit,
321324
offset=offset,
322325
order_by=order_by,
326+
job_type=job_type,
323327
client_id=self.workspace.client_id,
324328
client_secret=self.workspace.client_secret,
325329
bearer_token=self.workspace.bearer_token,

airbyte/mcp/cloud.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pathlib import Path
55
from typing import Annotated, Any, Literal, cast
66

7+
from airbyte_api.models import JobTypeEnum
78
from fastmcp import Context, FastMCP
89
from fastmcp_extensions import get_mcp_config, mcp_tool, register_mcp_tools
910
from pydantic import BaseModel, Field
@@ -737,6 +738,17 @@ def list_cloud_sync_jobs(
737738
default=None,
738739
),
739740
],
741+
job_type: Annotated[
742+
JobTypeEnum | None,
743+
Field(
744+
description=(
745+
"Filter by job type. Options: 'sync', 'reset', 'refresh', 'clear'. "
746+
"If not specified, defaults to sync and reset jobs only (API default). "
747+
"Use 'refresh' to find refresh jobs or 'clear' to find clear jobs."
748+
),
749+
default=None,
750+
),
751+
],
740752
) -> SyncJobListResult:
741753
"""List sync jobs for a connection with pagination support.
742754
@@ -767,6 +779,7 @@ def list_cloud_sync_jobs(
767779
limit=effective_limit,
768780
offset=jobs_offset,
769781
from_tail=from_tail,
782+
job_type=job_type,
770783
)
771784

772785
jobs = [

0 commit comments

Comments
 (0)