Skip to content

Commit 066b564

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 2fc8fd6 commit 066b564

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
@@ -309,25 +309,27 @@ After initialization:
309309
tmpl.Writer.LogTelemetry(ctx)
310310

311311
// Determine actual output directory (template writes to subdirectory with project name)
312-
actualOutputDir := outputDir
313-
if actualOutputDir == "" {
314-
actualOutputDir = name
312+
actualOutputDir := name
313+
if outputDir != "" {
314+
actualOutputDir = filepath.Join(outputDir, name)
315315
}
316316

317-
// Count files if we can
317+
// Count files and get absolute path
318318
fileCount := 0
319-
if absPath, err := filepath.Abs(actualOutputDir); err == nil {
320-
_ = filepath.Walk(absPath, func(path string, info os.FileInfo, err error) error {
321-
if err == nil && !info.IsDir() {
322-
fileCount++
323-
}
324-
return nil
325-
})
319+
absOutputDir, err := filepath.Abs(actualOutputDir)
320+
if err != nil {
321+
absOutputDir = actualOutputDir
326322
}
327-
cmdio.LogString(ctx, common.FormatScaffoldSuccess("appkit", actualOutputDir, fileCount))
323+
_ = filepath.Walk(absOutputDir, func(path string, info os.FileInfo, err error) error {
324+
if err == nil && !info.IsDir() {
325+
fileCount++
326+
}
327+
return nil
328+
})
329+
cmdio.LogString(ctx, common.FormatScaffoldSuccess("appkit", absOutputDir, fileCount))
328330

329331
// Generate and print file tree structure
330-
fileTree, err := generateFileTree(actualOutputDir)
332+
fileTree, err := generateFileTree(absOutputDir)
331333
if err == nil && fileTree != "" {
332334
cmdio.LogString(ctx, "\nFile structure:")
333335
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
@@ -30,6 +30,8 @@ When building or planning a new Databricks app, use the following steps:
3030

3131
invoke_databricks_cli 'experimental apps-mcp tools init-template --name my-app-name --description "My app description"'
3232

33+
This creates a `my-app-name/` directory in the current working directory containing the app files.
34+
3335
# Validation
3436

3537
⚠️ 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
@@ -503,6 +503,21 @@ npm run test:e2e:ui # Run with Playwright UI
503503

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

506+
### Map Libraries (react-leaflet)
507+
508+
For maps with React 19, use react-leaflet v5:
509+
510+
```bash
511+
npm install react-leaflet@^5.0.0 leaflet @types/leaflet
512+
```
513+
514+
Import CSS in your component:
515+
```typescript
516+
import 'leaflet/dist/leaflet.css';
517+
```
518+
519+
Note: react-leaflet v4.x requires React 18. Use v5 for React 19 compatibility.
520+
506521
### Best Practices:
507522

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

0 commit comments

Comments
 (0)