Skip to content

feat: add table filter to search_objects tool (#172)#177

Merged
tianzhou merged 1 commit intomainfrom
column_filter
Dec 15, 2025
Merged

feat: add table filter to search_objects tool (#172)#177
tianzhou merged 1 commit intomainfrom
column_filter

Conversation

@tianzhou
Copy link
Member

Add optional table parameter to search_objects tool for filtering columns and indexes by specific table name. This addresses performance issues when searching in large databases with thousands of columns.

Changes:

  • Add table parameter (exact match, requires schema)
  • Optimize searchColumns() to only query specified table
  • Optimize searchIndexes() to only query specified table
  • Add validation: table requires schema parameter
  • Add validation: table only applies to column/index object types
  • Clarify that schema parameter is exact match (not pattern)
  • Add comprehensive test coverage

Closes #172

🤖 Generated with Claude Code

Add optional table parameter to search_objects tool for filtering
columns and indexes by specific table name. This addresses performance
issues when searching in large databases with thousands of columns.

Changes:
- Add table parameter (exact match, requires schema)
- Optimize searchColumns() to only query specified table
- Optimize searchIndexes() to only query specified table
- Add validation: table requires schema parameter
- Add validation: table only applies to column/index object types
- Clarify that schema parameter is exact match (not pattern)
- Add comprehensive test coverage

Closes #172

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings December 15, 2025 15:44
@tianzhou tianzhou merged commit 23e4522 into main Dec 15, 2025
8 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a table filter parameter to the search_objects tool to optimize performance when searching for columns and indexes in large databases. The feature allows users to specify a table name to narrow their search, avoiding the need to query all tables in a schema when looking for specific column or index information.

Key changes:

  • Adds optional table parameter with exact match semantics, requiring schema to be specified
  • Optimizes searchColumns() and searchIndexes() to query only the specified table when table filter is provided
  • Adds validation to ensure table parameter only applies to column and index object types

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/tools/search-objects.ts Adds table parameter to schema, updates searchColumns and searchIndexes functions to support table filtering, and implements validation logic
src/tools/tests/search-objects.test.ts Adds comprehensive test coverage for table filtering functionality including validation tests for different object types

Comment on lines +479 to +493
// Validate table parameter
if (table) {
if (!schema) {
return createToolErrorResponse(
"The 'table' parameter requires 'schema' to be specified",
"SCHEMA_REQUIRED"
);
}
if (!["column", "index"].includes(object_type)) {
return createToolErrorResponse(
`The 'table' parameter only applies to object_type 'column' or 'index', not '${object_type}'`,
"INVALID_TABLE_FILTER"
);
}
}
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a table filter is provided, there's no validation that the table actually exists in the specified schema. This could lead to silent failures where users get zero results without any indication that the table name is incorrect. Consider adding validation using the connector's tableExists method (similar to the schema validation at lines 496-504), which would provide helpful feedback if the table doesn't exist. This would improve the user experience by catching typos or incorrect table names early.

Copilot uses AI. Check for mistakes.
@tianzhou tianzhou deleted the column_filter branch December 19, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter columns by table

1 participant