Repository navigation
fix(mcp): look up a signal, prompt, citation, opportunity, draft or report by what the person names - #2461
Merged
Conversation
…report by what the person names
Chat answered "what is X?" from the first page of a list, so an item past it
read as missing. Each list read now takes a direct lookup:
- list_signals: codes ("S-07", "S 7", "s7", "#7", "7") and ids, every status and date
- list_prompts: search (words of the text, any order and case) and ids, every topic and state
- get_prompt_performance: prompt_ids, whatever the topic; tracked prompts with no answers in no_results
- list_citations: domains (with subdomains, top pages and citing prompts) and urls (scheme, www and trailing slash aside), every source type
- list_content_opportunities, list_drafts, get_reports: search (title words) and ids, archived included
Each returns what it found and not_found, with a note to say "not found"
plainly and never offer the closest. A lookup is never cut by limit
(NAMED_ROWS). Every read keeps brandAllowed, the brand_id filter and the
organization join; words reach the filter only as escaped ilike patterns.
Shared helpers in lib/mcp/lookup.ts; MCP tool shapes unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…eport by what the person names An MCP client asked "what is S-07?", "how does the 'skip a month' prompt do?" or "is example.com cited?" could only page a list (50 signals, 100 prompts, the top 50 domains, ...), so an item past the page looked missing and the client could answer with the closest ones instead. Chat got direct lookups in ansvisor#2460; the MCP tools now read them the same way, through Chat's reads: the same query, rows and note, no second query. - list_signals: `codes` ("S-07", "S 7", "s7", "#7", "7") and `ids`, every status and date (lookUpSignalsFor). status, kind and limit don't apply. - list_prompts: `search` (words of the text, any order and case) and `ids`, every topic and state (lookUpPromptsFor). topic_id, is_active and limit don't apply. - get_prompt_performance: `prompt_ids`, whatever the topic, never cut by limit; tracked prompts with no answers in no_results (lookUpPromptPerformanceFor). topic_id, sort_by, order and limit don't apply. - list_citations: `domains` (with subdomains, top pages and citing prompts) and `urls` (scheme, www and trailing slash aside), every source type (lookUpCitationsFor). source_filter and limit don't apply. - list_content_opportunities, list_content_drafts, list_reports: `search` (title words) and `ids`, archived included where the list has it (lookUpOpportunitiesFor, lookUpDraftsFor, lookUpReportsFor). Their filters and limit don't apply. - A search pages 50 at a time: `offset` on those four tools takes the result's next_offset and applies to a search only. - Each returns { note, <rows>, not_found } in place of the list. Without a lookup input every tool reads exactly as before. - Scope as before: brandAllowed (organization and brand access), the brand_id filter and an inner join on the brand's organization. An id or code of another brand or workspace is not found; ids are checked as UUIDs, codes become numbers, words reach a filter only as escaped ilike patterns (ansvisor#2460). - Descriptions: read what the person names first; which list inputs a lookup ignores; "not found" plainly, never the closest; never say an item doesn't exist because a page didn't show it. get_report, get_content_draft and get_content_opportunity say where a named one's id comes from. - The REST mirrors (/api/mcp/*) are unchanged. - Docs: the MCP guide's rows. Help: one example line in the MCP article's "What you can ask". The coach skill names the new inputs where it lists each tool's inputs, and a pitfall for "missing because a list didn't show it". Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
cihan-gyk
dismissed
gkhngyk’s stale review
November 16, 2026 20:34
The merge-base changed after approval.
cihan-gyk
pushed a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Nov 16, 2026
Brings in ansvisor#2449, ansvisor#2450, ansvisor#2457, ansvisor#2460 and ansvisor#2461 (Chat and MCP lookups by code, id, words, domain or address; never give up on data it could read). Conflicts, resolved as the union of both sides: - agent-eval.ts: the scenario keeps askedSignals/askedDomains and checks; QUESTION_SCENARIOS holds action-by-code, signal-by-code, citation-by-domain and the three ai-revenue questions; every run gets "never gives up on data it could read" and then its scenario's checks. - agent-eval-data.ts: EvalWorkspace is default, action_backlog, long_lists and conversions_off; both sides' imports. - agent-eval.test.ts: both sides' imports. - brand-scope.test.ts: the AI-revenue reads and the lookups. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
This was referenced Nov 16, 2026
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.
Summary
#2460 gave Chat's reads direct lookups: a signal by its code, a prompt by its words, a cited domain or page by its address, and an opportunity, draft or report by its title. The MCP server, which Claude, ChatGPT and other clients use, still couldn't do this:
This PR gives the matching MCP tools the same lookups, through Chat's reads: the same query, rows and note, with no second query. It follows #2452 (
codesonlist_actions).Changes
list_signalscodes("S-07", "S 7", "s7", "#7", "7"),idslookUpSignalsForstatus,kind,limitlist_promptssearch(words of the text, any order and case),ids,offsetlookUpPromptsFortopic_id,is_active,limitget_prompt_performanceprompt_idslookUpPromptPerformanceFortopic_id,sort_by,order,limitlist_citationsdomains(with subdomains, top pages and citing prompts),urls(scheme,www.and a trailing slash aside)lookUpCitationsForsource_filter,limitlist_content_opportunitiessearch(title words),ids,offsetlookUpOpportunitiesForstatus,impact,type,limitlist_content_draftssearch(title words),ids,offsetlookUpDraftsForstatuslist_reportssearch(title words),ids,offsetlookUpReportsForlimit{ note, <rows>, not_found }instead of its list:signals,prompts,opportunities,draftsorreports;domains,urlsandperiodfor citations;promptsandno_resultsfor performance.total,offsetandnext_offset.LOOKUP_MAX). A search takes up to 200 characters.offsettakes the result'snext_offsetand applies only to a search, since these lists don't page today.limit. A tracked prompt with no answers in the window goes inno_results.brandAllowedchecks the key's or app's organization and brand access.brand_idand inner-joins the brand's organization.ilikepatterns (fix(chat): look up any listed item by its code, id, words or address #2460).get_report'sreport_id,get_content_draft'sdraft_idandget_content_opportunity'sopportunity_idnow say that one named by its title gets its id from the list'ssearch./api/mcp/*(signals,prompts,prompt-performance,citations,content-opportunities,content-drafts) share the list reads but don't take these inputs. A lookup returns a different shape (note, Chat's rows,not_found), which wouldn't match those routes' rows. This is the same reasoning as fix(mcp): look up an action by its code, and never answer with "the closest" ones #2452.approved-articles.jsonis regenerated.skills/ansvisor-aeo-coach/SKILL.md) lists each tool's inputs, so it now names the new ones. It also gets one pitfall: "Don't call something missing because a list didn't show it."How to test
From an MCP client, such as Claude with the Ansvisor connector, on a brand with plenty of data:
list_signalswithcodes: ["S-07"]and names the signal by its title and code, resolved ones too.list_prompts'search.get_prompt_performance'sprompt_ids.list_citationswithdomainsreturns it with its subdomains, top pages and the prompts citing it.search, and an archived draft is marked archived.Checks
npx tsc --noEmit -p .: passes.src/lib/mcp,src/app/api/mcp,src/lib/chat,src/lib/help,src/i18n,use-server-exportsandsubscription-guard-coverage: 270 files, 3,701 tests pass (1 skipped). This includes the MCP/Chat parity test (mcp-parity.test.ts) andserver.test.ts.lookups.test.ts, 15) call each tool through an MCP client and cover:not_foundwith its note;brandsread;limitand the list's filters not cutting a lookup;offset;brand-scope.test.ts: 7 new rows, one per tool, each a lookup on a brand not shared with a Selected-brands key. Each answers "Brand not found", reads onlybrandsand calls no function.main(git merge-tree).server.tsisn't a'use server'file, and its new helpers aren't exported.Generated by Claude Code