Skip to content

Commit 821650d

Browse files
authored
Apps-MCP: minor changes (#4057)
## Changes - fix maps-related prompt; - fix inconsistent working dir; - fix confusing bits in tool descriptions.
1 parent 7783e65 commit 821650d

File tree

5 files changed

+41
-22
lines changed

5 files changed

+41
-22
lines changed

experimental/apps-mcp/cmd/init_template.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -301,25 +301,27 @@ After initialization:
301301
tmpl.Writer.LogTelemetry(ctx)
302302

303303
// Determine actual output directory (template writes to subdirectory with project name)
304-
actualOutputDir := outputDir
305-
if actualOutputDir == "" {
306-
actualOutputDir = name
304+
actualOutputDir := name
305+
if outputDir != "" {
306+
actualOutputDir = filepath.Join(outputDir, name)
307307
}
308308

309-
// Count files if we can
309+
// Count files and get absolute path
310310
fileCount := 0
311-
if absPath, err := filepath.Abs(actualOutputDir); err == nil {
312-
_ = filepath.Walk(absPath, func(path string, info os.FileInfo, err error) error {
313-
if err == nil && !info.IsDir() {
314-
fileCount++
315-
}
316-
return nil
317-
})
311+
absOutputDir, err := filepath.Abs(actualOutputDir)
312+
if err != nil {
313+
absOutputDir = actualOutputDir
318314
}
319-
cmdio.LogString(ctx, common.FormatScaffoldSuccess("appkit", actualOutputDir, fileCount))
315+
_ = filepath.Walk(absOutputDir, func(path string, info os.FileInfo, err error) error {
316+
if err == nil && !info.IsDir() {
317+
fileCount++
318+
}
319+
return nil
320+
})
321+
cmdio.LogString(ctx, common.FormatScaffoldSuccess("appkit", absOutputDir, fileCount))
320322

321323
// Generate and print file tree structure
322-
fileTree, err := generateFileTree(actualOutputDir)
324+
fileTree, err := generateFileTree(absOutputDir)
323325
if err == nil && fileTree != "" {
324326
cmdio.LogString(ctx, "\nFile structure:")
325327
cmdio.LogString(ctx, fileTree)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ DATABRICKS APPS DEVELOPMENT
1515

1616
invoke_databricks_cli 'experimental apps-mcp tools init-template --name my-app-name --description "My app description"'
1717

18+
This creates a `my-app-name/` directory in the current working directory containing the app files.
19+
1820
# Validation
1921

2022
⚠️ Always validate your app before deploying to production:

experimental/apps-mcp/lib/providers/clitools/invoke_databricks_cli.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
)
1313

1414
// InvokeDatabricksCLI runs a Databricks CLI command and returns the output.
15-
func InvokeDatabricksCLI(ctx context.Context, command []string, workingDirectory string) (string, error) {
16-
if len(command) == 0 {
17-
return "", errors.New("command is required")
15+
func InvokeDatabricksCLI(ctx context.Context, args []string, workingDirectory string) (string, error) {
16+
if len(args) == 0 {
17+
return "", errors.New("args is required")
1818
}
1919

2020
workspaceClient, err := middlewares.GetDatabricksClient(ctx)
@@ -26,7 +26,7 @@ func InvokeDatabricksCLI(ctx context.Context, command []string, workingDirectory
2626

2727
// GetCLIPath returns the path to the current CLI executable
2828
cliPath := common.GetCLIPath()
29-
cmd := exec.CommandContext(ctx, cliPath, command...)
29+
cmd := exec.CommandContext(ctx, cliPath, args...)
3030
cmd.Dir = workingDirectory
3131
env := os.Environ()
3232
env = append(env, "DATABRICKS_HOST="+host)

experimental/apps-mcp/lib/providers/clitools/provider.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (p *Provider) RegisterTools(server *mcpsdk.Server) error {
5252
mcpsdk.AddTool(server,
5353
&mcpsdk.Tool{
5454
Name: "databricks_configure_auth",
55-
Description: "Configure authentication for Databricks. Only call when Databricks authentication has has failed to authenticate automatically or when the user explicitly asks for using a specific host or profile. Validates credentials and stores the authenticated client in the session.",
55+
Description: "Configure authentication for Databricks. Only call when Databricks authentication has failed to authenticate automatically or when the user explicitly asks for using a specific host or profile. Validates credentials and stores the authenticated client in the session.",
5656
},
5757
func(ctx context.Context, req *mcpsdk.CallToolRequest, args ConfigureAuthInput) (*mcpsdk.CallToolResult, any, error) {
5858
log.Debug(ctx, "databricks_configure_auth called")
@@ -89,7 +89,7 @@ func (p *Provider) RegisterTools(server *mcpsdk.Server) error {
8989
mcpsdk.AddTool(server,
9090
&mcpsdk.Tool{
9191
Name: "explore",
92-
Description: "**REQUIRED DURING PLAN MODE** - Call this FIRST when planning ANY Databricks work. Use this to discover available workspaces, warehouses, and get workflow recommendations for your specific task. Even if you're just reading an assignment document, call this first. Especially important when task involves: creating Databricks projects/apps/pipelines/jobs, SQL pipelines or data transformation workflows, deploying code to multiple environments (dev/prod), or working with databricks.yml files. You DON'T need a workspace name - call this when starting ANY Databricks planning to understand workspace capabilities and recommended tooling before you create your plan.",
92+
Description: "Discover available Databricks workspaces, warehouses, and get workflow recommendations. Call this FIRST when planning ANY Databricks work involving apps, pipelines, jobs, bundles, or SQL workflows. Returns workspace capabilities and recommended tooling.",
9393
},
9494
func(ctx context.Context, req *mcpsdk.CallToolRequest, args struct{}) (*mcpsdk.CallToolResult, any, error) {
9595
log.Debug(ctx, "explore called")
@@ -104,16 +104,16 @@ func (p *Provider) RegisterTools(server *mcpsdk.Server) error {
104104
// Register invoke_databricks_cli tool
105105
type InvokeDatabricksCLIInput struct {
106106
WorkingDirectory string `json:"working_directory" jsonschema:"required" jsonschema_description:"The directory to run the command in."`
107-
Args []string `json:"args" jsonschema:"required" jsonschema_description:"The arguments to pass to the Databricks CLI command e.g. ['bundle', 'deploy'] or ['bundle', 'validate']. Do not include the 'databricks' prefix."`
107+
Args []string `json:"args" jsonschema:"required" jsonschema_description:"CLI arguments as array, e.g. [\"bundle\", \"deploy\"] or [\"bundle\", \"validate\", \"--target\", \"dev\"]. Do not include 'databricks' prefix."`
108108
}
109109

110110
mcpsdk.AddTool(server,
111111
&mcpsdk.Tool{
112112
Name: "invoke_databricks_cli",
113-
Description: "Execute Databricks CLI command. Pass all arguments as a single string.",
113+
Description: "Execute Databricks CLI command. Pass arguments as an array of strings.",
114114
},
115115
func(ctx context.Context, req *mcpsdk.CallToolRequest, args InvokeDatabricksCLIInput) (*mcpsdk.CallToolResult, any, error) {
116-
log.Debugf(ctx, "invoke_databricks_cli called: args=%s, working_directory=%s", args.Args, args.WorkingDirectory)
116+
log.Debugf(ctx, "invoke_databricks_cli called: args=%v, working_directory=%s", args.Args, args.WorkingDirectory)
117117
result, err := InvokeDatabricksCLI(ctx, args.Args, args.WorkingDirectory)
118118
if err != nil {
119119
return nil, nil, err

experimental/apps-mcp/templates/appkit/template/{{.project_name}}/CLAUDE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,21 @@ npm run test:e2e:ui # Run with Playwright UI
453453

454454
- `SelectItem` cannot have `value=""`. Use sentinel value like `"all"` for "show all" options.
455455

456+
### Map Libraries (react-leaflet)
457+
458+
For maps with React 19, use react-leaflet v5:
459+
460+
```bash
461+
npm install react-leaflet@^5.0.0 leaflet @types/leaflet
462+
```
463+
464+
Import CSS in your component:
465+
```typescript
466+
import 'leaflet/dist/leaflet.css';
467+
```
468+
469+
Note: react-leaflet v4.x requires React 18. Use v5 for React 19 compatibility.
470+
456471
### Best Practices:
457472

458473
- Use shadcn/radix components (Button, Input, Card, etc.) for consistent UI

0 commit comments

Comments
 (0)