Skip to content

[skills] Add an interactive schema picker to ug skill add --mcp - #588

Open
xsh310 wants to merge 1 commit into
skills-download-workspace-idfrom
skills-mcp-add-picker
Open

xsh310 wants to merge 1 commit into
skills-download-workspace-idfrom
skills-mcp-add-picker

Conversation

@xsh310

@xsh310 xsh310 commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

What

ug skill add --mcp with no --location errored asking for a typed schema. On an
interactive terminal it now opens a picker of the workspace's schemas that contain
skills, streamed in as discovery finds them, and adds the selected schemas to the
skills MCP connection's scope.

Why

The download path already has an interactive picker; the MCP scope path was the only
add-side flow still requiring a typed --location. This makes the two symmetric.

How

  • The picker (in mcp.py, beside the other skill MCP-scope commands) reuses the download
    picker's machinery: the workspace walk (list_all_skills) and the streaming checkbox
    widget. list_all_skills probes one schema per call, so each streamed batch is one
    schema's skill set; the loader renders one row per schema with its exact skill count.
  • Already-scoped schemas are flagged and stay selectable; re-selecting is a no-op, since
    adding is additive (removal is ug skill remove --mcp).
  • To let both mcp.py (picker) and skills_download.py (download) use the workspace walk
    without a circular import, the UC skills read layer (SkillRef, the API client, and
    list_all_skills) moves into a new skills_api.py that depends only on databricks.py.
  • add_skills_command's apply body is extracted into add_skill_locations_to_mcp, shared
    by the command and the picker so each runs a single client setup.
  • Non-interactive (no TTY) still errors asking for --location, so scripts fail loudly.

Testing

uv run ruff check, ruff format --check, ty check src, and uv run pytest all pass
(the pre-existing test_e2e_user_agent / test_claude_smart_routing_v2 failures also fail
on the base). The read-layer tests move to test_skills_api.py; added tests for the schema
picker, its command, add_skill_locations_to_mcp / configured_skill_locations, and the CLI
dispatch.

Stack

Part of gh stack #576, on top of #586 (skills-download-workspace-id).

This pull request and its description were written by Isaac.

Screen.Recording.2026-09-12.at.11.35.02.PM.mov

Stack created with GitHub Stacks CLIGive Feedback 💬

@xsh310
xsh310 added this pull request to stack #576 September 13, 2026 04:28
Comment thread src/ucode/cli.py Outdated
Comment thread src/ucode/skills_download.py Outdated
Comment thread src/ucode/mcp.py Outdated
Comment thread src/ucode/skills_download.py Outdated
Comment thread src/ucode/mcp.py Outdated
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch 2 times, most recently from d6d37f1 to c934e64 Compare September 13, 2026 06:25
@xsh310
xsh310 marked this pull request as ready for review September 13, 2026 06:37
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from c934e64 to 54a8370 Compare September 14, 2026 03:08
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from 54a8370 to 35a710b Compare September 14, 2026 20:09
Comment thread src/ucode/mcp.py
location = f"{refs[0].catalog}.{refs[0].schema}"
append([_skill_schema_choice(location, len(refs), location in in_scope)])

list_all_skills(workspace, token, on_skills=on_skills)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: list_all_skills(...) returns (refs, reason) and yields partial results once its 30s wall-clock deadline is hit (or a schema probe errors), but the loader discards the return. When the walk times out on a large/slow workspace, the picker simply stops adding rows and the "Loading more…" footer disappears — indistinguishable from a complete load. The user then scopes only the schemas that happened to arrive in time, believing they've seen everything.

Suggest capturing reason and surfacing it — e.g. append a disabled sentinel row (⚠ schema discovery timed out — showing partial results) or print_warning after the picker closes. Same pattern exists in the download picker's _skills_download_background_loader (#579).

@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from 35a710b to d94e61f Compare September 14, 2026 22:32
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch 2 times, most recently from dee8c30 to bad3f91 Compare September 15, 2026 01:41
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from bad3f91 to 29363a9 Compare September 15, 2026 03:40
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from 29363a9 to 70ae698 Compare September 15, 2026 04:42
`ug skill add --mcp` with no --location errored asking for a typed schema. On an
interactive terminal it now opens a picker of the workspace's schemas that contain
skills, streamed in as discovery finds them, and adds the selected schemas to the
skills MCP scope.

The picker mirrors the download picker and reuses its machinery: the workspace walk
(list_all_skills) and the streaming checkbox widget. Because list_all_skills probes
one schema per call, each batch is one schema's skill set, so the loader renders one
row per schema with its exact skill count. Already-scoped schemas are flagged and
stay selectable, since adding is additive (removal is `ug skill remove --mcp`).

To let both the picker (in mcp.py) and the download flow use the workspace walk
without a circular import, the UC skills read layer (SkillRef, the API client, and
list_all_skills) moves into a new skills_api.py that depends only on databricks.py;
mcp.py and skills_download.py both import it. add_skills_command's apply body is
extracted into add_skill_locations_to_mcp, shared by the command and the picker.

Co-authored-by: Isaac <no-reply@databricks.com>
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from 70ae698 to f84cc77 Compare September 15, 2026 14:43
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.

2 participants