Skip to content

fix: getRegistryPrompt never validates its own declared-required prompt arguments #5770

Description

@JSONbored

Goal

Make getRegistryPrompt validate the required arguments its own PROMPT_DEFINITIONS metadata declares, instead of silently interpolating missing values as placeholder text.

Why this matters

This is the one dispatch surface in the MCP package with its own required-field metadata that doesn't enforce it — every other tool handler validates required args and returns a proper error.

Current behavior

packages/mcp/src/registry-prompts-lib.js:

  • PROMPT_DEFINITIONS (lines 11-72) marks use_case (asset.find), category/name (submission.prepare), draft (submission.review), and category/slug (install.asset) as required: true.
  • getRegistryPrompt (lines 84-140) never checks presence of these — missing values are interpolated as literal placeholder text ("(not provided)", "(category)", "(slug)", "(draft not provided)") directly into the guidance sent back to the MCP client, instead of returning an error.
  • Wired in via packages/mcp/src/server-lib.js:98 (getRegistryPrompt(request.params || {})) with no other validation layer in between.
  • Every tool handler elsewhere in the package (getEntryDetail, getCompareEntries, etc.) validates required args and returns an invalid() envelope on failure — the prompt path is the outlier.

Desired behavior

getRegistryPrompt checks each prompt's declared required args before building the response, and returns a proper error/invalid envelope (consistent with how tool handlers elsewhere in the package report missing required args) instead of silently degrading into placeholder text.

Scope

  • packages/mcp/src/registry-prompts-lib.js (getRegistryPrompt)
  • focused tests

Out of scope

  • PROMPT_DEFINITIONS's existing required-field declarations (already correct)
  • Tool handlers that already validate correctly

Acceptance criteria

  • PR includes Closes #<issue>.
  • Calling any prompt with a missing required argument now returns an error/invalid response instead of a placeholder-filled guidance string.
  • Calling with all required arguments present behaves exactly as before.

Quality evidence required in the PR

  • API/MCP invariant note: list the exact error shape returned for a missing-required-arg call, and confirm it doesn't break existing valid-call behavior.

Validation

pnpm test:mcp
pnpm build
git diff --check

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.5x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions