Skip to content

Commit eba6da6

Browse files
authored
apps-MCP: template prompts decomposition (#4084)
## Changes - decompose the only large structureless CLAUDE.md into bite-sized dedicated sub-documents; - hide the confusing long list of npm commands in favor of instructing the agent to use encapsulated `validate`; - create a way to regenerate types without `npm run dev` (as discussed with @ditadi and @fjakobs, there will be an official way, thus my implementation should be considered as temporal one). ## Why - improve locality of instructions; - reduce amount of confusion points; - ensure maintainability of prompts; ## Tests Tested manually and via bulk generation
1 parent 2da2d76 commit eba6da6

File tree

14 files changed

+660
-823
lines changed

14 files changed

+660
-823
lines changed

experimental/apps-mcp/lib/prompts/flow.tmpl

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,40 @@
55
* Contains: available tools, CLI patterns, best practices.
66
*/ -}}
77

8-
## Available Tools
9-
- **databricks_discover**: Discover workspace resources and get workflow recommendations (call this first)
8+
## Databricks MCP Available Tools
9+
- **databricks_discover**: Discover workspace resources and get workflow recommendations
1010
- **databricks_configure_auth**: Switch workspace profile/host
1111
- **invoke_databricks_cli**: Execute any Databricks CLI command
1212

1313
## Workflow Best Practices
14-
- Use `databricks_discover` at the start of tasks to understand workspace context
15-
- Use `invoke_databricks_cli` for all Databricks CLI operations
16-
- For Databricks Asset Bundles: validate before deploying
14+
- Use `databricks_discover` at the beginning of your session to get context-aware recommendations
15+
- For operations affecting live environments, ask for confirmation
16+
- Always validate before deploying
1717
- When not sure about the user's intent, ask clarifying questions
18-
- Do NOT create summary files, reports, or README unless explicitly requested
1918

2019
{{.WorkspaceInfo}}{{if .WarehouseName}}
2120
Default SQL Warehouse: {{.WarehouseName}} ({{.WarehouseID}}){{else}}
2221
Note: No SQL warehouse detected. SQL queries will require warehouse_id to be specified manually.{{end}}{{.ProfilesInfo}}
2322

24-
IMPORTANT: Use invoke_databricks_cli for all commands below!
23+
## Universal Databricks CLI Patterns
24+
Use `invoke_databricks_cli '<command>'` to run any Databricks CLI command.
2525

26-
## SQL Queries
27-
Execute SQL using the query tool:
28-
invoke_databricks_cli 'experimental apps-mcp tools query "SELECT * FROM catalog.schema.table LIMIT 10"'
26+
### Project scaffolding
2927

30-
## Exploring Resources
28+
For apps:
29+
30+
invoke_databricks_cli 'experimental apps-mcp tools init-template --name my-app --description "My app description"'
31+
32+
- App name must be ≤26 characters (dev- prefix adds 4 chars, max total 30)
33+
- Use lowercase letters, numbers, and hyphens only
34+
35+
Other types of projects are not yet supported.
36+
37+
### Custom SQL Queries
38+
39+
invoke_databricks_cli 'experimental apps-mcp tools query "SELECT * FROM catalog.schema.table LIMIT 10"'
40+
41+
### Exploring Resources
3142
Jobs:
3243
invoke_databricks_cli 'jobs list'
3344
invoke_databricks_cli 'jobs get <job_id>'
@@ -41,15 +52,5 @@ Unity Catalog:
4152
invoke_databricks_cli 'tables list <catalog> <schema>'
4253
invoke_databricks_cli 'experimental apps-mcp tools discover-schema TABLE1 TABLE2 TABLE3'
4354

44-
⚠️ Use separate arguments for catalog/schema: 'tables list samples tpcds_sf1' (not dot notation)
45-
46-
## Databricks Asset Bundles
47-
New project:
48-
invoke_databricks_cli 'bundle init'
49-
invoke_databricks_cli 'bundle validate'
50-
invoke_databricks_cli 'bundle deploy --target dev'
51-
52-
Existing project:
53-
invoke_databricks_cli 'bundle validate'
54-
invoke_databricks_cli 'bundle deploy --target <environment>'
55-
invoke_databricks_cli 'bundle run <resource_name>'
55+
Use separate arguments for catalog/schema: 'tables list samples tpcds_sf1' (not dot notation).
56+
Dot notation is only supported in `experimental apps-mcp tools discover-schema` and `experimental apps-mcp tools query`.

experimental/apps-mcp/lib/prompts/target_apps.tmpl

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,29 @@
77

88
## Databricks Apps Development
99

10-
### Building a New App
11-
1. Scaffold: invoke_databricks_cli 'experimental apps-mcp tools init-template --name my-app --description "My app description"'
12-
2. Read CLAUDE.md in the generated directory
13-
3. Navigate to project: cd <project_name>
14-
4. Run locally: npm install && npm run dev (opens http://localhost:8000)
15-
1610
### Validation
1711
⚠️ Always validate before deploying:
1812
invoke_databricks_cli 'experimental apps-mcp tools validate ./'
1913

14+
This is battle-tested to catch common issues before deployment. Prefer using this over manual checks (e.g. `npm run lint`), as it covers more ground specific to Databricks Apps.
15+
2016
### Deployment
2117
⚠️ USER CONSENT REQUIRED: Only deploy with explicit user permission.
2218
invoke_databricks_cli 'experimental apps-mcp tools deploy'
2319

24-
### App Naming
25-
- App name must be ≤26 characters (dev- prefix adds 4 chars, max total 30)
26-
- Use lowercase letters, numbers, and hyphens only
27-
2820
### View and Manage
2921
invoke_databricks_cli 'bundle summary'
22+
23+
### Local Development vs Deployed Apps
24+
25+
During development:
26+
- Start template-specific dev server (see project's CLAUDE.md for command and port)
27+
- Use localhost URL shown when dev server starts
28+
29+
After deployment:
30+
- Get URL from: invoke_databricks_cli 'bundle summary'
31+
32+
Decision tree:
33+
- "open the app" + not deployed → localhost
34+
- "open the app" + deployed → ask which environment
35+
- "localhost"/"local" → always localhost

experimental/apps-mcp/lib/validation/nodejs.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ func (v *ValidationNodeJs) Validate(ctx context.Context, workDir string) (*Valid
3232
errorPrefix: "Failed to install dependencies",
3333
displayName: "Install",
3434
},
35+
{
36+
name: "generate",
37+
command: "npm run typegen --if-present",
38+
errorPrefix: "Failed to run npm typegen",
39+
displayName: "Type generation",
40+
},
3541
{
3642
name: "build",
3743
command: "npm run build --if-present",

experimental/apps-mcp/templates/appkit/databricks_template_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
"order": 4
2626
}
2727
},
28-
"success_message": "\nYour new project has been created in the '{{.project_name}}' directory!\nYOU MUST read {{.project_name}}/CLAUDE.md immediately. It is STRONGLY RECOMMENDED to immediately run `npm install`, run `npm run dev` in the background, and open http://localhost:8000 in your browser before making changes to the app."
28+
"success_message": "\nYour new project has been created in the '{{.project_name}}' directory!\nYOU MUST read {{.project_name}}/CLAUDE.md immediately."
2929
}

0 commit comments

Comments
 (0)