Repository navigation
fix(mcp): edgar_fund returns AMBIGUOUS_BDC instead of guessing between BDCs - #1398
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bead edgartools-1c6z (salvaged from closed PR #1380).
Problem
When the identifier isn't a ticker or CIK,
edgar_fund(bdc_portfolio) usedfind_bdc(identifier, top_n=1)[0].find_bdcscores 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:
Otherwise the tool returns
AMBIGUOUS_BDCwith up to fivename: 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:
Verification
_bdc_portfolio("Golub")call that assertsAMBIGUOUS_BDC, the exact suggestions, and that no portfolio was fetched. The end-to-end test fails against main.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