Skip to content

Commit 834201f

Browse files
committed
Merge KAB-871-ref to KAB-871-feat
2 parents 8edc8f9 + b5d9b3d commit 834201f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/keboola_mcp_server/component_tools.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ def add_component_tools(mcp: FastMCP) -> None:
175175

176176
async def list_components(ctx: Context) -> List[ComponentListItem]:
177177
"""Retrieve a list of all available Keboola components in the project."""
178-
client = ctx.session.state["sapi_client"]
179-
assert isinstance(client, KeboolaClient)
178+
client = KeboolaClient.from_state(ctx.session.state)
180179

181180
r_components = client.storage_client.components.list()
182181
logger.info(f"Found {len(r_components)} components.")
@@ -192,9 +191,8 @@ async def list_component_configurations(
192191
],
193192
ctx: Context,
194193
) -> List[ComponentConfigurationListItem]:
195-
"""Retrieve all configurations that exist for a specific Keboola component."""
196-
client = ctx.session.state["sapi_client"]
197-
assert isinstance(client, KeboolaClient)
194+
client = KeboolaClient.from_state(ctx.session.state)
195+
198196

199197
component = await get_component_details(component_id, ctx)
200198
r_configs = client.storage_client.configurations.list(component_id)
@@ -214,8 +212,8 @@ async def get_component_details(
214212
ctx: Context,
215213
) -> Component:
216214
"""Retrieve detailed information about a original Keboola component object given component ID."""
217-
client = ctx.session.state["sapi_client"]
218-
assert isinstance(client, KeboolaClient)
215+
client = KeboolaClient.from_state(ctx.session.state)
216+
219217
endpoint = "branch/{}/components/{}".format(client.storage_client._branch_id, component_id)
220218
r_component = await client.get(endpoint)
221219
return Component.model_validate(r_component)

0 commit comments

Comments
 (0)