Optimize MCP tool docstrings for token efficiency#394
Open
QuentinAmbard wants to merge 11 commits intomainfrom
Open
Optimize MCP tool docstrings for token efficiency#394QuentinAmbard wants to merge 11 commits intomainfrom
QuentinAmbard wants to merge 11 commits intomainfrom
Conversation
- Reduce docstring verbosity across all 18 tool files (~89% reduction) - Keep all functional information while being concise - Add skill references to complex tools (dashboards, vector search, genie, jobs, pipelines, lakebase, unity catalog, serving, apps, agent bricks) - Maintain human readability with bullet points and structure - Preserve critical warnings (ASK USER FIRST, CONFIRM WITH USER) - Keep return format hints for AI parsing Net reduction: 1,843 lines across 18 files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- agent_bricks.py: Add context for description, instructions, volume_path, examples - genie.py: Add context for table_identifiers, description, sample_questions, serialized_space - jobs.py: Add context for tasks, job_clusters, environments, schedule, git_source - lakebase.py: Add context for source_branch, ttl_seconds, is_protected, autoscaling params, and sync source/target table names - pipelines.py: Add context for root_path, workspace_file_paths, extra_settings, full_refresh 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Tool consolidations: - pipelines.py: 10→2 (manage_pipeline, manage_pipeline_run) - volume_files.py: 6→1 (manage_volume_files) - aibi_dashboards.py: 4→1 (manage_dashboard) - vector_search.py: 8→4 (manage_vs_endpoint, manage_vs_index, query_vs_index, manage_vs_data) - genie.py: 5→2 (manage_genie, ask_genie) - serving.py: 3→1 (manage_serving_endpoint) - apps.py: 3→1 (manage_app) - file.py: 2→1 (manage_workspace_files) - sql.py: 6→5 (manage_warehouse replaces list/get_best) - lakebase.py: 8→4 (manage_lakebase_database, manage_lakebase_branch, manage_lakebase_sync, generate_lakebase_credential) Key patterns: - All consolidated tools use an action parameter - Each action has required params documented in docstring - Error messages specify which params are required - Hot paths (query_vs_index, ask_genie) kept separate for clarity - All skills updated with action tables and examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Test infrastructure: - Add comprehensive integration tests for all MCP tools - Add test runner script with parallel execution support - Add fixtures for workspace, catalog, and resource cleanup - Add test resources (PDFs, SQL files, app configs) Bug fixes in databricks-tools-core: - Fix workspace file upload for directories - Fix job notebook path handling - Fix vector search index operations - Fix apps API responses - Fix dashboard widget handling - Fix agent bricks manager listing Bug fixes in MCP server tools: - Add quota skip handling for apps test - Fix genie space operations - Fix lakebase database operations - Fix compute cluster lifecycle handling - Fix dashboard operations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The Databricks SDK's w.apps.deploy() returns a Wait[AppDeployment] object, not an AppDeployment directly. The previous code passed the Wait object to _deployment_to_dict(), which caused getattr() to return None for all attributes since the Wait object doesn't have them. This fix uses wait_obj.response to get the actual AppDeployment object before converting it to a dictionary. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3 tasks
Collaborator
Author
|
Recommended workflow:
|
- Add tools summary table at top of MCP Tools section - Change code blocks from python syntax to plain text - Add "# MCP Tool: <name>" comments to clarify these are tool calls, not Python code - Move Supporting Tools table to main tools table 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Remove garbage characters from widget documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Use w.genie.trash_space() in _delete_genie_resource - Add _find_space_by_name() using SDK's list_spaces with pagination - Use w.genie.update_space() and w.genie.create_space() for space management - Use w.genie.get_space() with include_serialized_space in _get_genie_space - Fix validation to allow space_id for updates without display_name 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add per-suite timeout in run_tests.py (10 min default, configurable) - Improve apps test with better cleanup and assertions - Add skip logic for quota-exceeded scenarios 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…cumentation Add detailed parameter documentation to all 9 Unity Catalog MCP tools: - manage_uc_objects: Document parameters by object_type (catalog/schema/volume/function) - manage_uc_grants: Add privilege lists per securable type - manage_uc_storage: Detail credential and external_location parameters - manage_uc_connections: Document connection_type options and create_foreign_catalog - manage_uc_tags: Detail set_tags/unset_tags/query parameters - manage_uc_security_policies: Document row filter and column mask parameters - manage_uc_monitors: Detail monitor creation and refresh parameters - manage_uc_sharing: Document share/recipient/provider resource types - manage_metric_views: Detail dimension/measure format and query parameters 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add clear instructions requiring users to: 0. Review the databricks-aibi-dashboards skill for widget JSON structure 1. Call get_table_stats_and_schema() for table schemas 2. Call execute_sql() to test EVERY query before use This prevents widgets from showing errors due to untested queries. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR optimizes MCP tools for better AI efficiency through docstring compression, tool consolidation, and improved documentation.
Key Changes
1. Tool Consolidation (77 → 44 tools, 43% reduction)
manage_pipeline,manage_pipeline_runmanage_volume_filesmanage_vs_endpoint,manage_vs_index,query_vs_index,manage_vs_datamanage_genie,ask_geniemanage_dashboardmanage_serving_endpointmanage_appmanage_workspace_filesmanage_warehousereplaces list/get_bestmanage_lakebase_database,manage_lakebase_branch,manage_lakebase_sync,generate_lakebase_credential2. Docstring Optimization (~89% reduction in documentation size)
3. Comprehensive Parameter Documentation
4. Bug Fixes (discovered via integration tests)
deploy_appreturnedWait[AppDeployment]object instead ofAppDeploymentwait_obj.responseto get actual deployment objectw.genie.trash_space(),w.genie.update_space(),w.genie.create_space(),w.genie.get_space()5. Integration Test Infrastructure
Skill References Added
Complex tools now reference corresponding skills for detailed documentation:
databricks-aibi-dashboards- widget JSON structures, filter typesdatabricks-vector-search- index spec details (delta_sync, direct_access)agent-bricks- KA/MAS configurationdatabricks-genie- Genie space setupdatabricks-jobs- task configuration detailsdatabricks-spark-declarative-pipelines- pipeline setupdatabricks-lakebase-provisioned/autoscale- database typesdatabricks-unity-catalog- UC guidancedatabricks-model-serving- endpoint configurationdatabricks-app-python- app developmentRunning Integration Tests
Prerequisites:
DATABRICKS_HOSTandDATABRICKS_TOKENenvironment variables~/.databrickscfgwith a DEFAULT profileCommits
Test plan
🤖 Generated with Claude Code