Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bac6149
AI-1172 test: add tests for global search tool and from_api_response …
mariankrotil Jul 9, 2025
426c43d
AI-1172 test: add end2end integtest for global search tool
mariankrotil Jul 9, 2025
09fa4eb
AI-1172 test: skip integtest for global search tool if it is not enab…
mariankrotil Jul 9, 2025
5b2ed8d
Merge branch 'AI-1172-global-search' into AI-1172-global-search-tests
mariankrotil Jul 9, 2025
59cd32a
AI-1172 chore: update version
mariankrotil Jul 9, 2025
2dde986
AI-1172 refactor: update wrt changes
mariankrotil Jul 9, 2025
588d9c3
AI-1172 refactor: move find_component_id tool to search tools
mariankrotil Jul 9, 2025
a2343a1
Merge branch 'AI-1172-global-search' into AI-1172-global-search-tests
mariankrotil Jul 9, 2025
438a5c9
AI-1172 test: update tests wrt changes of AI-1172-global-search-tool
mariankrotil Jul 9, 2025
efc7bbc
Merge AI-1172-tests to AI-1172-ref
mariankrotil Jul 9, 2025
4f13df9
AI-1172 fix: add await for coroutine method
mariankrotil Jul 9, 2025
cc9bb31
Merge branch 'AI-1172-global-search-tests' into AI-1172-search-tools-ref
mariankrotil Jul 9, 2025
51147ff
AI-1172 chore: update version
mariankrotil Jul 9, 2025
cab25d9
Merge branch 'AI-1172-global-search' into AI-1172-global-search-tests
mariankrotil Jul 10, 2025
419a815
AI-1172 refactor: rename variables and parameters wrt review and merge
mariankrotil Jul 10, 2025
6759edb
AI-1172 fix: fix the config name to align with other test names (star…
mariankrotil Jul 10, 2025
b426187
AI-1172 test: revert config name change, use rather searching for oth…
mariankrotil Jul 10, 2025
b87a38a
AI-1172 test: rename the test config name to 'test_config1' to align …
mariankrotil Jul 10, 2025
bdb322d
Merge branch 'AI-1172-global-search' into AI-1172-global-search-tests
mariankrotil Jul 14, 2025
eded2ae
AI-1172 test: update tests wrt merge and add other testing values
mariankrotil Jul 14, 2025
f997732
Merge AI-1172-global-search-tests to AI-1172-refactor
mariankrotil Jul 14, 2025
e0be650
Merge pull request #204 from keboola/AI-1172-search-tools-ref
mariankrotil Jul 14, 2025
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
72 changes: 72 additions & 0 deletions integtests/tools/test_search.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import logging

import pytest
from fastmcp import Context

from integtests.conftest import BucketDef, ConfigDef, TableDef
from keboola_mcp_server.client import KeboolaClient
from keboola_mcp_server.tools.search import GlobalSearchOutput, global_search

LOG = logging.getLogger(__name__)


@pytest.mark.asyncio
async def test_global_search_end_to_end(
keboola_client: KeboolaClient,
mcp_context: Context,
buckets: list[BucketDef],
tables: list[TableDef],
configs: list[ConfigDef],
) -> None:
"""
Test the global_search tool end-to-end by searching for entities that exist in the test project.
This verifies that the search returns expected results for buckets, tables, and configurations.
"""

# skip this test if the global search is not available
if not await keboola_client.storage_client.is_enabled('global-search'):
LOG.warning('Global search is not available. Please enable it in the project settings.')
pytest.skip('Global search is not available. Please enable it in the project settings.')

# Search for test entities by name prefix 'test' which should match our test data
result = await global_search(
ctx=mcp_context, name_prefixes=['test'], entity_types=tuple(), limit=50, offset=0 # Search all types
)

# Verify the result structure
assert isinstance(result, GlobalSearchOutput)
assert isinstance(result.counts, dict)
assert isinstance(result.type_groups, list)
assert 'total' in result.counts

# Verify we found some results
assert result.counts['total'] > 0, 'Should find at least some test entities'

# Create sets of expected IDs for verification
expected_bucket_ids = {bucket.bucket_id for bucket in buckets}
expected_table_ids = {table.table_id for table in tables}
expected_config_ids = {config.configuration_id for config in configs if config.configuration_id}

# Check that we can find test buckets
bucket_groups = [group for group in result.type_groups if group.group_type == 'bucket']
if bucket_groups:
bucket_group = bucket_groups[0]
found_bucket_ids = {item.id for item in bucket_group.group_items}
# At least some test buckets should be found
assert found_bucket_ids.intersection(expected_bucket_ids), 'Should find at least one test bucket'

# Check that we can find test tables
table_groups = [group for group in result.type_groups if group.group_type == 'table']
if table_groups:
table_group = table_groups[0]
found_table_ids = {item.id for item in table_group.group_items}
# At least some test tables should be found
assert found_table_ids.intersection(expected_table_ids), 'Should find at least one test table'

# Check that we can find test configurations
config_groups = [group for group in result.type_groups if group.group_type == 'configuration']
if config_groups:
config_group = config_groups[0]
found_config_ids = {item.id for item in config_group.group_items}
# At least some test configurations should be found
assert found_config_ids.intersection(expected_config_ids), 'Should find at least one test configuration'
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "keboola-mcp-server"
version = "1.10.0"
version = "1.10.1"
description = "MCP server for interacting with Keboola Connection"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
Loading