Skip to content

fix(mcp): edgar_fund returns AMBIGUOUS_BDC instead of guessing between BDCs - #1398

Merged
dgunning merged 1 commit into
mainfrom
fix/mcp-bdc-ambiguous-name
Oct 1, 2026
Merged

dgunning merged 1 commit into
mainfrom
fix/mcp-bdc-ambiguous-name

Conversation

@dgunning

@dgunning dgunning commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Bead edgartools-1c6z (salvaged from closed PR #1380).

Problem

When the identifier isn't a ticker or CIK, edgar_fund (bdc_portfolio) used find_bdc(identifier, top_n=1)[0]. find_bdc scores every whole-word hit near 100, so the top hit tells you nothing. "Golub" matches four Golub BDCs at 99.4 to 100 and silently became GOLUB CAPITAL BDC.

Fix

A name now resolves only when:

  1. exactly one result equals the query, ignoring case, punctuation and a trailing Corp/Inc./LLC/LP-style suffix; or
  2. the top hit scores ≥ 95 and the runner-up scores < 90.

Otherwise the tool returns AMBIGUOUS_BDC with up to five name: identifier='<CIK>' suggestions. It uses the CIK rather than the ticker because non-traded BDCs have no ticker.

This is PR #1380's rule (d12c057) with one change. Its literal full-name comparison would have made "Ares Capital" and "Prospect Capital" ambiguous: their sibling funds score 99.3, and neither query equals "…CORP". Both resolve correctly today, and ignoring the suffix keeps them resolving.

Measured on 17 live queries:

  • Ambiguous: Golub, Ares, Blackstone, Blue Owl, Gladstone, Oaktree, Monroe, Barings, Hercules
  • Resolved: Ares Capital, Ares Capital Corp, Main Street, Prospect Capital, Hercules Capital, Blue Owl Capital Corp, WhiteHorse, Saratoga, Sixth Street

Verification

  • Fast tests: the resolution rule, using the measured score rows, and an end-to-end _bdc_portfolio("Golub") call that asserts AMBIGUOUS_BDC, the exact suggestions, and that no portfolio was fetched. The end-to-end test fails against main.
  • Live: "Golub" returns the five Golub CIKs.
  • test-fast: the only failure is the dt1f1 20-F test, which also fails on main.

Out of scope, noted: Sixth Street Specialty Lending (TSLX, CIK 1508655) is in none of the last three SEC BDC reports. Ticker and name searches can't find it, so "Sixth Street" resolves to Sixth Street Lending Partners.

🤖 Generated with Claude Code

…n BDCs (1c6z)

_bdc_portfolio fell back to find_bdc(identifier, top_n=1)[0] when the
identifier was neither a ticker nor a CIK. find_bdc scores every
whole-word hit near 100 (it only nudges toward the closest full name), so
the top hit identified nothing: "Golub" matches four Golub BDCs at
99.4-100 and silently became GOLUB CAPITAL BDC.

_pick_bdc_search_winner resolves a name only when (a) exactly one result
equals the query ignoring case, punctuation and a trailing corporate
suffix, or (b) the top hit scores >= 95 and the runner-up < 90. Otherwise
the tool returns AMBIGUOUS_BDC with up to five "name: identifier='CIK'"
suggestions (CIK, not ticker: non-traded BDCs have none).

The rule is PR #1380's (d12c057) with one change: it compared full names
literally, which would have made "Ares Capital" and "Prospect Capital"
ambiguous (siblings score 99.3; neither equals "...CORP"), though both
resolve correctly today. Ignoring the suffix keeps them resolving.
Measured on 17 queries: Golub, Ares, Blackstone, Blue Owl, Gladstone,
Oaktree, Monroe, Barings, Hercules -> ambiguous; Ares Capital, Main
Street, Prospect Capital, Hercules Capital, WhiteHorse, Saratoga -> one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dgunning
dgunning enabled auto-merge (squash) October 1, 2026 21:45
@dgunning
dgunning merged commit 90d741d into main Oct 1, 2026
10 checks passed
@dgunning
dgunning deleted the fix/mcp-bdc-ambiguous-name branch October 1, 2026 21:59
@dgunning dgunning mentioned this pull request Oct 2, 2026
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.

1 participant