Skip to content

Optimize MCP tool docstrings for token efficiency#394

Open
QuentinAmbard wants to merge 2 commits intomainfrom
mcp-tool-token-optimization
Open

Optimize MCP tool docstrings for token efficiency#394
QuentinAmbard wants to merge 2 commits intomainfrom
mcp-tool-token-optimization

Conversation

@QuentinAmbard
Copy link
Copy Markdown
Collaborator

Summary

  • Reduced MCP tool docstring verbosity across all 18 tool files
  • Added skill references to complex tools so AI can load detailed documentation when needed
  • Maintained human readability while being token-efficient

Token Reduction

Net reduction: 1,843 lines removed (~89% reduction in documentation size)

File Lines Removed
unity_catalog.py -285
vector_search.py -229
aibi_dashboards.py -190
genie.py -179
compute.py -150
pipelines.py -145
lakebase.py -143
agent_bricks.py -127
sql.py -109
jobs.py -108
serving.py -98
volume_files.py -75
apps.py -68
file.py -46
manifest.py -44
pdf.py -38
workspace.py -36
user.py -13

Skill References Added

Complex tools now reference their corresponding skills for detailed documentation:

  • databricks-aibi-dashboards - widget JSON structures, filter types
  • databricks-vector-search - index spec details (delta_sync, direct_access)
  • agent-bricks - KA/MAS configuration
  • databricks-genie - Genie space setup
  • databricks-jobs - task configuration details
  • databricks-spark-declarative-pipelines - pipeline setup
  • databricks-lakebase-provisioned/autoscale - database types
  • databricks-unity-catalog - UC guidance
  • databricks-model-serving - endpoint configuration
  • databricks-app-python - app development

Test plan

  • Verify AI can still use tools correctly with compressed docstrings
  • Confirm skill references load correct documentation when needed
  • Test complex tools (dashboards, vector search) work as expected

🤖 Generated with Claude Code

Quentin Ambard and others added 2 commits March 30, 2026 10:20
- 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>
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.

1 participant