vn6295337 Claude Opus 4.5 commited on
Commit
89f2b8e
·
1 Parent(s): 50c0d03

fix: Clean company name suffixes before MCP server queries

Browse files

- Add stock suffixes to filters: "- Common Stock", "- Class A/B/C", etc.
- Apply clean_company_name() in parse_research_request()
- Prevents polluted search queries like "Microsoft Corporation - Common Stock stock news"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +4 -0
  2. configs/company_name_filters.py +6 -0
app.py CHANGED
@@ -190,6 +190,10 @@ def parse_research_request(message: dict) -> tuple[Optional[str], Optional[str]]
190
  if not ticker:
191
  ticker = text.upper().replace(" ", "")[:5]
192
 
 
 
 
 
193
  return ticker, company_name
194
 
195
 
 
190
  if not ticker:
191
  ticker = text.upper().replace(" ", "")[:5]
192
 
193
+ # Clean company name (strip "- Common Stock", "Inc.", etc.)
194
+ from configs.company_name_filters import clean_company_name
195
+ company_name = clean_company_name(company_name)
196
+
197
  return ticker, company_name
198
 
199
 
configs/company_name_filters.py CHANGED
@@ -5,6 +5,12 @@ Add suffixes/prefixes here as new edge cases are discovered.
5
 
6
  # Suffixes to strip from company names (order matters - longer first)
7
  COMPANY_SUFFIXES = [
 
 
 
 
 
 
8
  " Corporation",
9
  " Incorporated",
10
  " Technologies",
 
5
 
6
  # Suffixes to strip from company names (order matters - longer first)
7
  COMPANY_SUFFIXES = [
8
+ " - Common Stock",
9
+ " - Class A Common Stock",
10
+ " - Class B Common Stock",
11
+ " - Class C Common Stock",
12
+ " - Ordinary Shares",
13
+ " - American Depositary Shares",
14
  " Corporation",
15
  " Incorporated",
16
  " Technologies",