Skip to content
Merged
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
4 changes: 4 additions & 0 deletions airbyte/_util/api_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ def get_job_logs( # noqa: PLR0913 # Too many arguments - needed for auth flexi
bearer_token: SecretString | None,
offset: int | None = None,
order_by: str | None = None,
job_type: models.JobTypeEnum | None = None,
) -> list[models.JobResponse]:
"""Get a list of jobs for a connection.

Expand All @@ -600,6 +601,8 @@ def get_job_logs( # noqa: PLR0913 # Too many arguments - needed for auth flexi
bearer_token: Bearer token for authentication (alternative to client credentials).
offset: Number of jobs to skip from the beginning. Defaults to None (0).
order_by: Field and direction to order by (e.g., "createdAt|DESC"). Defaults to None.
job_type: Filter by job type (e.g., JobTypeEnum.SYNC, JobTypeEnum.REFRESH).
If not specified, defaults to sync and reset jobs only (API default behavior).

Returns:
A list of JobResponse objects.
Expand All @@ -617,6 +620,7 @@ def get_job_logs( # noqa: PLR0913 # Too many arguments - needed for auth flexi
limit=limit,
offset=offset,
order_by=order_by,
job_type=job_type,
),
)
if status_ok(response.status_code) and response.jobs_response:
Expand Down
6 changes: 5 additions & 1 deletion airbyte/cloud/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


if TYPE_CHECKING:
from airbyte_api.models import ConnectionResponse, JobResponse
from airbyte_api.models import ConnectionResponse, JobResponse, JobTypeEnum
Comment thread
aaronsteers marked this conversation as resolved.

from airbyte.cloud.workspaces import CloudWorkspace

Expand Down Expand Up @@ -291,6 +291,7 @@ def get_previous_sync_logs(
limit: int = 20,
offset: int | None = None,
from_tail: bool = True,
job_type: JobTypeEnum | None = None,
) -> list[SyncResult]:
"""Get previous sync jobs for a connection with pagination support.

Expand All @@ -304,6 +305,8 @@ def get_previous_sync_logs(
from_tail: If True, returns jobs ordered newest-first (createdAt DESC).
If False, returns jobs ordered oldest-first (createdAt ASC).
Defaults to True.
job_type: Filter by job type (e.g., JobTypeEnum.SYNC, JobTypeEnum.REFRESH).
If not specified, defaults to sync and reset jobs only (API default behavior).

Returns:
A list of SyncResult objects representing the sync jobs.
Expand All @@ -320,6 +323,7 @@ def get_previous_sync_logs(
limit=limit,
offset=offset,
order_by=order_by,
job_type=job_type,
client_id=self.workspace.client_id,
client_secret=self.workspace.client_secret,
bearer_token=self.workspace.bearer_token,
Expand Down
13 changes: 13 additions & 0 deletions airbyte/mcp/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path
from typing import Annotated, Any, Literal, cast

from airbyte_api.models import JobTypeEnum
from fastmcp import Context, FastMCP
from fastmcp_extensions import get_mcp_config, mcp_tool, register_mcp_tools
from pydantic import BaseModel, Field
Expand Down Expand Up @@ -737,6 +738,17 @@ def list_cloud_sync_jobs(
default=None,
),
],
job_type: Annotated[
JobTypeEnum | None,
Field(
description=(
"Filter by job type. Options: 'sync', 'reset', 'refresh', 'clear'. "
"If not specified, defaults to sync and reset jobs only (API default). "
"Use 'refresh' to find refresh jobs or 'clear' to find clear jobs."
),
default=None,
),
],
) -> SyncJobListResult:
"""List sync jobs for a connection with pagination support.

Expand Down Expand Up @@ -767,6 +779,7 @@ def list_cloud_sync_jobs(
limit=effective_limit,
offset=jobs_offset,
from_tail=from_tail,
job_type=job_type,
)

jobs = [
Expand Down