Skip to content

multi-get does not resolve docids despite docs/examples #706

@rolldav

Description

@rolldav

Summary

qmd get "#docid" resolves short docids correctly, but qmd multi-get "#docid" and qmd multi-get "#docid,#other" do not, even though the README and MCP tool description say multi-get / multi_get supports docids.

This may be either a docs mismatch or a missing docid-resolution branch in multiGet / findDocuments.

Version / environment

  • qmd: 2.5.3
  • installed from npm: npm install -g @tobilu/qmd@latest
  • macOS, Node >= 22

Expected behavior

Given a search/get result with docid #1c9a4c, both of these should retrieve the document, per docs:

qmd multi-get "#1c9a4c"
qmd multi-get "#1c9a4c,#688343"

The README says:

multi_get — Batch retrieve by glob pattern, comma-separated list, or docids

And the bundled QMD skill says:

qmd multi-get "#abc123,#def432" --format md

Actual behavior

get works:

$ qmd get '#1c9a4c:1:5'
qmd://obs-projects/garde-sos-planning-system.md  #1c9a4c
---

1: ---
2: id: prj-01KT6VCQQ5QMY497FS2SBEHM9J
3: type: Project
4: created_at: 2026-06-03
5: updated_at: 2026-06-03

But multi-get does not resolve the same docid:

$ qmd multi-get '#1c9a4c' -l 2
No files matched pattern: #1c9a4c

$ qmd multi-get '#1c9a4c,#688343' --format md -l 2
File not found: #1c9a4c
File not found: #688343

Passing a collection path works:

$ qmd multi-get 'obs-projects/garde-sos-planning-system.md' -l 2
============================================================
File: garde-sos-planning-system.md  #1c9a4c
============================================================

1: ---
2: id: prj-01KT6VCQQ5QMY497FS2SBEHM9J

Likely code path

In the published 2.5.3 build:

  • get has an explicit docid branch around dist/cli/qmd.js:
// Handle docid lookup (#abc123, abc123, "#abc123", "abc123", etc.)
if (isDocid(inputPath)) {
  const docidMatch = findDocumentByDocid(db, inputPath);
  ...
}
  • multiGet around dist/cli/qmd.js only treats comma-separated entries as virtual paths or path/suffix matches. It does not appear to call isDocid() / findDocumentByDocid() for each entry.

  • MCP multi_get calls store findDocuments(pattern, ...), and dist/store.js similarly treats comma-separated names as qmd:///path matches, not docid matches.

Why this matters

Agents often get docids from search results and then batch-retrieve selected hits. The docs advertise exactly this pattern, but the current behavior forces agents to call get repeatedly or convert docids back to paths first.

Possible fix direction

Before path/virtual-path matching in multiGet / findDocuments, resolve each comma-separated item with the same docid logic used by get:

  • if isDocid(name), call findDocumentByDocid(db, name)
  • use the matched document path / collection to fetch the row

Alternatively, if docid support is not intended for multi-get, the README and bundled skill should remove the docid examples.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions