Skip to content

fix(mcp): search_tools ranks each tool by its overview, not its field reference - #148

Merged
mikipalet merged 1 commit into
developfrom
fix/mcp-standalone-ad-search
Dec 3, 2026
Merged

mikipalet merged 1 commit into
developfrom
fix/mcp-standalone-ad-search

Conversation

@mikipalet

Copy link
Copy Markdown
Member

Why

A customer's agent searched for "Create ad", "leadGenFormId" and instant form ads and never got ad_campaigns_create_standalone_ad. Its description carries a ~100K-character field reference (~90x the average tool), so BM25 length normalisation buried it, even for "standalone ad".

What

  • BM25 index text = tool name + overview (description up to the first heading or Args:), not every argument's description.
  • Spec copy picks up the wording from zernio-dev/Schedule-Posts-API#12808 (lead form / instant form ads on createStandaloneAd, Click-to-Message on createMessagingAd); the next regenerate is a no-op for it.
  • Test: lead form queries rank the ad create in the top 3, messaging ad queries rank messaging_ads_create_messaging_ad first. Catalog cache tests now assert one index build and fresh-vs-cached parity.
  • Measured over all 1,423 hidden tools with each tool's title as the query: top-3 hit rate 96.5% to 98.7%.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TkrdQRi6X5geRp6AW7xCbH

… reference

ad_campaigns_create_standalone_ad carries a ~100K-character field reference
(~90x the average tool), so BM25 length normalisation kept it out of results
even for "standalone ad" and "lead form ad". Index the name plus the overview
up to the first heading or Args section. Also picks up the spec wording that
names lead form / instant form and Click-to-Message ads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TkrdQRi6X5geRp6AW7xCbH
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