Skip to content

MCP language_help always returns empty topics: skillsDir() misses dist/skills #207

Description

@aszenz

Problem

The MCP language_help tool always returns {"topics":[]} in the published package (@malloydata/cli 0.0.55, also on next). Every lookup fails with No topic matches '<x>'. All other MCP tools (compile, compile_file, run, run_file, prettify) work fine.

language_help()        -> {"topics":[]}
language_help("joins") -> {"error":"No topic matches 'joins'."}

Root cause

language_help loads malloy-language-reference.md via skillsDir() in src/mcp/skills.ts:

const candidates = [
  path.join(__dirname, '..', 'skills'),
  path.join(__dirname, '..', '..', 'skills'),
];

The published bundle is dist/cli.js, so at runtime __dirname is <pkg>/dist and the candidates resolve to <pkg>/skills and <pkg>/../skills — neither exists. The build actually ships the reference inside dist, at <pkg>/dist/skills/malloy-language-reference.md (confirmed in the 0.0.55 tarball). So fs.existsSync is false, the text is empty, no ## headers are parsed, and an empty topic list is cached.

Fix

Add the published location to the candidates:

const candidates = [
  path.join(__dirname, 'skills'),        // dist/skills — published layout
  path.join(__dirname, '..', 'skills'),
  path.join(__dirname, '..', '..', 'skills'),
];

Environment

@malloydata/cli 0.0.55 (also next), run as an MCP server via npx --package @malloydata/cli malloy-cli -- ... mcp.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions