grantsignal-mcp 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agency-aliases.d.ts +44 -0
- package/dist/agency-aliases.d.ts.map +1 -0
- package/dist/agency-aliases.js +324 -0
- package/dist/agency-aliases.js.map +1 -0
- package/dist/formatters.d.ts +59 -0
- package/dist/formatters.d.ts.map +1 -0
- package/dist/formatters.js +140 -0
- package/dist/formatters.js.map +1 -0
- package/dist/gap-detection.d.ts +67 -0
- package/dist/gap-detection.d.ts.map +1 -0
- package/dist/gap-detection.js +316 -0
- package/dist/gap-detection.js.map +1 -0
- package/dist/post-processing.d.ts +15 -1
- package/dist/post-processing.d.ts.map +1 -1
- package/dist/post-processing.js +19 -2
- package/dist/post-processing.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2095 -1011
- package/dist/server.js.map +1 -1
- package/dist/tier-config.d.ts +22 -0
- package/dist/tier-config.d.ts.map +1 -0
- package/dist/tier-config.js +86 -0
- package/dist/tier-config.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GrantSignal MCP Server — Agency Alias Resolution
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive alias map for NYC, NYS, and federal agency names.
|
|
5
|
+
* Resolves acronyms, misspellings, abbreviations, and informal names
|
|
6
|
+
* to canonical forms used across GrantSignal data sources.
|
|
7
|
+
*/
|
|
8
|
+
export interface AgencyInfo {
|
|
9
|
+
canonical: string;
|
|
10
|
+
fullName: string;
|
|
11
|
+
checkbookName?: string;
|
|
12
|
+
code?: string;
|
|
13
|
+
searchTerms: string[];
|
|
14
|
+
level: "nyc" | "nys" | "federal";
|
|
15
|
+
}
|
|
16
|
+
export declare const PROGRAM_ACRONYMS: Record<string, string>;
|
|
17
|
+
export interface ResolvedAgency {
|
|
18
|
+
canonical: string;
|
|
19
|
+
fullName: string;
|
|
20
|
+
checkbookName?: string;
|
|
21
|
+
code?: string;
|
|
22
|
+
searchTerms: string[];
|
|
23
|
+
level: "nyc" | "nys" | "federal";
|
|
24
|
+
resolved: boolean;
|
|
25
|
+
original: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve an agency input string to its canonical form.
|
|
29
|
+
*
|
|
30
|
+
* Checks exact match first, then tries substring matching against all
|
|
31
|
+
* search terms. Falls back to the original input if no match found.
|
|
32
|
+
*
|
|
33
|
+
* @returns ResolvedAgency with `resolved: true` if input was mapped to canonical
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveAgency(input: string): ResolvedAgency;
|
|
36
|
+
/**
|
|
37
|
+
* Get the best filter value to pass to a Supabase RPC.
|
|
38
|
+
*
|
|
39
|
+
* @param prefer - 'checkbook' returns the exact Checkbook agency_name (best for spending/budget RPCs)
|
|
40
|
+
* 'code' returns the 3-digit agency code
|
|
41
|
+
* 'canonical' (default) returns the acronym
|
|
42
|
+
*/
|
|
43
|
+
export declare function getAgencyFilterValue(resolved: ResolvedAgency, prefer?: 'checkbook' | 'code' | 'canonical' | boolean): string;
|
|
44
|
+
//# sourceMappingURL=agency-aliases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agency-aliases.d.ts","sourceRoot":"","sources":["../src/agency-aliases.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;CAClC;AA+MD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAoBnD,CAAC;AA2BF,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CA+C3D;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,cAAc,EACxB,MAAM,GAAE,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,OAAqB,GACjE,MAAM,CAcR"}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GrantSignal MCP Server — Agency Alias Resolution
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive alias map for NYC, NYS, and federal agency names.
|
|
5
|
+
* Resolves acronyms, misspellings, abbreviations, and informal names
|
|
6
|
+
* to canonical forms used across GrantSignal data sources.
|
|
7
|
+
*/
|
|
8
|
+
// ── NYC Agencies (~25) ──────────────────────────────────────
|
|
9
|
+
const NYC_AGENCIES = [
|
|
10
|
+
{
|
|
11
|
+
canonical: "DFTA", fullName: "Department for the Aging", code: "125", level: "nyc",
|
|
12
|
+
searchTerms: ["dfta", "deta", "aging", "dept for the aging", "department for the aging", "senior services", "seniors", "older adults"],
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
canonical: "DYCD", fullName: "Department of Youth and Community Development", code: "260", level: "nyc",
|
|
16
|
+
searchTerms: ["dycd", "youth", "community development", "dept of youth", "department of youth and community development", "after school", "afterschool", "compass", "beacon"],
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
canonical: "DOHMH", fullName: "Department of Health and Mental Hygiene", code: "816", level: "nyc",
|
|
20
|
+
searchTerms: ["dohmh", "health", "mental hygiene", "dept of health", "department of health", "public health", "mental health"],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
canonical: "ACS", fullName: "Administration for Children's Services", code: "068", level: "nyc",
|
|
24
|
+
searchTerms: ["acs", "children's services", "child welfare", "child services", "administration for children", "foster care", "child protective"],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
canonical: "DHS", fullName: "Department of Homeless Services", code: "069", level: "nyc",
|
|
28
|
+
searchTerms: ["dhs", "homeless services", "dept of homeless", "department of homeless services", "shelter", "homelessness"],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
canonical: "HRA", fullName: "Human Resources Administration", code: "071", level: "nyc",
|
|
32
|
+
searchTerms: ["hra", "dss", "human resources administration", "dept of social services", "department of social services", "social services", "welfare", "public assistance", "snap", "food stamps", "cash assistance"],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
canonical: "DOE", fullName: "Department of Education (NYC)", checkbookName: "Department of Education", code: "040", level: "nyc",
|
|
36
|
+
searchTerms: ["doe", "doe nyc", "nyc doe", "nyc education", "nyc dept of education", "nyc department of education", "department of education", "dept of education", "public schools nyc", "board of education nyc"],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
canonical: "NYPD", fullName: "New York City Police Department", checkbookName: "Police Department", code: "056", level: "nyc",
|
|
40
|
+
searchTerms: ["nypd", "police", "nyc police", "new york city police", "law enforcement nyc", "police department"],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
canonical: "FDNY", fullName: "Fire Department of the City of New York", checkbookName: "Fire Department", code: "057", level: "nyc",
|
|
44
|
+
searchTerms: ["fdny", "fire department", "fire dept", "nyc fire"],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
canonical: "HPD", fullName: "Department of Housing Preservation and Development", code: "806", level: "nyc",
|
|
48
|
+
searchTerms: ["hpd", "housing preservation", "housing development", "dept of housing", "department of housing", "affordable housing nyc", "housing nyc"],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
canonical: "DOT", fullName: "Department of Transportation (NYC)", code: "841", level: "nyc",
|
|
52
|
+
searchTerms: ["dot nyc", "nyc dot", "nyc transportation", "dept of transportation nyc", "streets", "traffic nyc"],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
canonical: "DPR", fullName: "Department of Parks and Recreation", code: "846", level: "nyc",
|
|
56
|
+
searchTerms: ["dpr", "parks", "parks and recreation", "dept of parks", "department of parks", "nyc parks", "recreation"],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
canonical: "DCLA", fullName: "Department of Cultural Affairs", code: "126", level: "nyc",
|
|
60
|
+
searchTerms: ["dcla", "cultural affairs", "dept of cultural affairs", "department of cultural affairs", "arts", "culture", "cultural funding"],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
canonical: "SBS", fullName: "Department of Small Business Services", code: "801", level: "nyc",
|
|
64
|
+
searchTerms: ["sbs", "small business", "small business services", "dept of small business", "department of small business services", "mwbe", "workforce1"],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
canonical: "DEP", fullName: "Department of Environmental Protection", code: "826", level: "nyc",
|
|
68
|
+
searchTerms: ["dep", "environmental protection", "dept of environmental protection", "water", "sewer", "environment nyc"],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
canonical: "DSNY", fullName: "Department of Sanitation", code: "827", level: "nyc",
|
|
72
|
+
searchTerms: ["dsny", "sanitation", "dept of sanitation", "department of sanitation", "garbage", "recycling", "waste", "cleanup"],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
canonical: "DOB", fullName: "Department of Buildings", code: "810", level: "nyc",
|
|
76
|
+
searchTerms: ["dob", "buildings", "dept of buildings", "department of buildings", "building permits", "construction permits"],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
canonical: "MOCJ", fullName: "Mayor's Office of Criminal Justice", code: "098", level: "nyc",
|
|
80
|
+
searchTerms: ["mocj", "criminal justice", "mayor's office of criminal justice", "public safety"],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
canonical: "NYCHA", fullName: "New York City Housing Authority", level: "nyc",
|
|
84
|
+
searchTerms: ["nycha", "housing authority", "public housing", "section 8 nyc"],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
canonical: "H+H", fullName: "NYC Health + Hospitals", level: "nyc",
|
|
88
|
+
searchTerms: ["h+h", "hhc", "health and hospitals", "health + hospitals", "nyc health hospitals", "public hospitals", "bellevue", "elmhurst hospital", "kings county hospital"],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
canonical: "NYCEDC", fullName: "NYC Economic Development Corporation", level: "nyc",
|
|
92
|
+
searchTerms: ["nycedc", "edc", "economic development", "economic development corporation"],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
canonical: "MOIA", fullName: "Mayor's Office of Immigrant Affairs", level: "nyc",
|
|
96
|
+
searchTerms: ["moia", "immigrant affairs", "immigration", "immigrant services"],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
canonical: "MOPD", fullName: "Mayor's Office for People with Disabilities", level: "nyc",
|
|
100
|
+
searchTerms: ["mopd", "disabilities", "people with disabilities", "disability services"],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
canonical: "DVS", fullName: "Department of Veterans' Services", level: "nyc",
|
|
104
|
+
searchTerms: ["dvs", "veterans", "veteran services", "dept of veterans"],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
canonical: "OATH", fullName: "Office of Administrative Trials and Hearings", level: "nyc",
|
|
108
|
+
searchTerms: ["oath", "administrative trials", "hearings"],
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
// ── NYS Agencies (~10) ──────────────────────────────────────
|
|
112
|
+
const NYS_AGENCIES = [
|
|
113
|
+
{
|
|
114
|
+
canonical: "NYSED", fullName: "New York State Education Department", level: "nys",
|
|
115
|
+
searchTerms: ["nysed", "nys education", "state education", "education department nys", "board of regents"],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
canonical: "NYSDOH", fullName: "New York State Department of Health", level: "nys",
|
|
119
|
+
searchTerms: ["nysdoh", "nys health", "state health", "nys dept of health", "nys department of health"],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
canonical: "OTDA", fullName: "Office of Temporary and Disability Assistance", level: "nys",
|
|
123
|
+
searchTerms: ["otda", "temporary assistance", "disability assistance", "nys welfare", "tanf nys"],
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
canonical: "OCFS", fullName: "Office of Children and Family Services", level: "nys",
|
|
127
|
+
searchTerms: ["ocfs", "children and family", "nys children", "nys family services", "child care nys"],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
canonical: "OMH", fullName: "Office of Mental Health", level: "nys",
|
|
131
|
+
searchTerms: ["omh", "nys mental health", "state mental health", "office of mental health"],
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
canonical: "OASAS", fullName: "Office of Addiction Services and Supports", level: "nys",
|
|
135
|
+
searchTerms: ["oasas", "addiction services", "substance abuse nys", "nys addiction", "drug treatment nys"],
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
canonical: "NYSERDA", fullName: "New York State Energy Research and Development Authority", level: "nys",
|
|
139
|
+
searchTerms: ["nyserda", "energy research", "nys energy", "clean energy nys", "energy efficiency nys"],
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
canonical: "ESD", fullName: "Empire State Development", level: "nys",
|
|
143
|
+
searchTerms: ["esd", "empire state development", "nys economic development", "excelsior", "nys incentives"],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
canonical: "DOS", fullName: "Department of State (NYS)", level: "nys",
|
|
147
|
+
searchTerms: ["nys dos", "department of state nys", "nys dept of state", "nys charities"],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
canonical: "DEC", fullName: "Department of Environmental Conservation", level: "nys",
|
|
151
|
+
searchTerms: ["dec", "nys dec", "environmental conservation", "nys environment", "nys dept of environmental conservation"],
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
// ── Federal Agencies (~12) ──────────────────────────────────
|
|
155
|
+
const FEDERAL_AGENCIES = [
|
|
156
|
+
{
|
|
157
|
+
canonical: "HHS", fullName: "Department of Health and Human Services", level: "federal",
|
|
158
|
+
searchTerms: ["hhs", "health and human services", "dept of health and human services", "department of health and human services"],
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
canonical: "DOE-FED", fullName: "Department of Education (Federal)", level: "federal",
|
|
162
|
+
searchTerms: ["doe federal", "federal doe", "us doe", "federal education", "ed.gov", "us department of education"],
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
canonical: "EPA", fullName: "Environmental Protection Agency", level: "federal",
|
|
166
|
+
searchTerms: ["epa", "environmental protection agency", "environment federal"],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
canonical: "USDA", fullName: "U.S. Department of Agriculture", level: "federal",
|
|
170
|
+
searchTerms: ["usda", "agriculture", "dept of agriculture", "department of agriculture", "farm bill", "rural development"],
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
canonical: "NIH", fullName: "National Institutes of Health", level: "federal",
|
|
174
|
+
searchTerms: ["nih", "national institutes of health", "biomedical research", "medical research federal"],
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
canonical: "NSF", fullName: "National Science Foundation", level: "federal",
|
|
178
|
+
searchTerms: ["nsf", "national science foundation", "science funding", "research funding federal"],
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
canonical: "DOJ", fullName: "Department of Justice", level: "federal",
|
|
182
|
+
searchTerms: ["doj", "dept of justice", "department of justice", "justice department", "federal law enforcement", "ojp", "bja"],
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
canonical: "DOL", fullName: "Department of Labor", level: "federal",
|
|
186
|
+
searchTerms: ["dol", "dept of labor", "department of labor", "labor department", "workforce", "wioa", "employment federal"],
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
canonical: "HUD", fullName: "Department of Housing and Urban Development", level: "federal",
|
|
190
|
+
searchTerms: ["hud", "housing and urban development", "dept of housing", "department of housing and urban development", "cdbg", "section 8", "affordable housing federal"],
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
canonical: "DOT", fullName: "Department of Transportation (Federal)", level: "federal",
|
|
194
|
+
searchTerms: ["dot federal", "federal dot", "dept of transportation", "department of transportation", "fhwa", "fta", "federal transit"],
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
canonical: "FEMA", fullName: "Federal Emergency Management Agency", level: "federal",
|
|
198
|
+
searchTerms: ["fema", "emergency management", "disaster relief", "federal emergency"],
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
canonical: "SBA", fullName: "Small Business Administration", level: "federal",
|
|
202
|
+
searchTerms: ["sba", "small business administration", "small business federal"],
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
// ── Common Program Acronyms (reference, not agencies) ───────
|
|
206
|
+
export const PROGRAM_ACRONYMS = {
|
|
207
|
+
NORC: "Naturally Occurring Retirement Community",
|
|
208
|
+
NDA: "Neighborhood Development Area",
|
|
209
|
+
COMPASS: "Comprehensive After School System of NYC",
|
|
210
|
+
SYEP: "Summer Youth Employment Program",
|
|
211
|
+
SNAP: "Supplemental Nutrition Assistance Program",
|
|
212
|
+
LIHTC: "Low-Income Housing Tax Credit",
|
|
213
|
+
CDBG: "Community Development Block Grant",
|
|
214
|
+
MWBE: "Minority and Women-owned Business Enterprise",
|
|
215
|
+
"M/WBE": "Minority and Women-owned Business Enterprise",
|
|
216
|
+
SCRIE: "Senior Citizen Rent Increase Exemption",
|
|
217
|
+
DRIE: "Disability Rent Increase Exemption",
|
|
218
|
+
ELL: "English Language Learner",
|
|
219
|
+
ARPA: "American Rescue Plan Act",
|
|
220
|
+
WIOA: "Workforce Innovation and Opportunity Act",
|
|
221
|
+
TANF: "Temporary Assistance for Needy Families",
|
|
222
|
+
SSVF: "Supportive Services for Veteran Families",
|
|
223
|
+
VASH: "Veterans Affairs Supportive Housing",
|
|
224
|
+
"CASA": "Court Appointed Special Advocates",
|
|
225
|
+
DoVE: "Domestic Violence Empowerment",
|
|
226
|
+
};
|
|
227
|
+
// ── Merged Agency List ──────────────────────────────────────
|
|
228
|
+
const ALL_AGENCIES = [
|
|
229
|
+
...NYC_AGENCIES,
|
|
230
|
+
...NYS_AGENCIES,
|
|
231
|
+
...FEDERAL_AGENCIES,
|
|
232
|
+
];
|
|
233
|
+
// Build lookup index: lowercase search term → AgencyInfo
|
|
234
|
+
const ALIAS_INDEX = new Map();
|
|
235
|
+
for (const agency of ALL_AGENCIES) {
|
|
236
|
+
// Index by canonical (lowercase)
|
|
237
|
+
ALIAS_INDEX.set(agency.canonical.toLowerCase(), agency);
|
|
238
|
+
// Index by all search terms
|
|
239
|
+
for (const term of agency.searchTerms) {
|
|
240
|
+
ALIAS_INDEX.set(term.toLowerCase(), agency);
|
|
241
|
+
}
|
|
242
|
+
// Index by code if present
|
|
243
|
+
if (agency.code) {
|
|
244
|
+
ALIAS_INDEX.set(agency.code, agency);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Resolve an agency input string to its canonical form.
|
|
249
|
+
*
|
|
250
|
+
* Checks exact match first, then tries substring matching against all
|
|
251
|
+
* search terms. Falls back to the original input if no match found.
|
|
252
|
+
*
|
|
253
|
+
* @returns ResolvedAgency with `resolved: true` if input was mapped to canonical
|
|
254
|
+
*/
|
|
255
|
+
export function resolveAgency(input) {
|
|
256
|
+
const trimmed = input.trim();
|
|
257
|
+
const lower = trimmed.toLowerCase();
|
|
258
|
+
// 1. Exact match against index
|
|
259
|
+
const exact = ALIAS_INDEX.get(lower);
|
|
260
|
+
if (exact) {
|
|
261
|
+
return {
|
|
262
|
+
...exact,
|
|
263
|
+
resolved: exact.canonical.toLowerCase() !== lower,
|
|
264
|
+
original: trimmed,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
// 2. Check if input is a numeric agency code
|
|
268
|
+
if (/^\d{2,3}$/.test(trimmed)) {
|
|
269
|
+
const byCode = ALIAS_INDEX.get(trimmed);
|
|
270
|
+
if (byCode) {
|
|
271
|
+
return { ...byCode, resolved: true, original: trimmed };
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
// 3. Substring match: find agencies where any search term contains the input
|
|
275
|
+
// or the input contains any search term (for longer inputs like full names)
|
|
276
|
+
const candidates = [];
|
|
277
|
+
for (const agency of ALL_AGENCIES) {
|
|
278
|
+
for (const term of agency.searchTerms) {
|
|
279
|
+
if (term.includes(lower) || lower.includes(term)) {
|
|
280
|
+
candidates.push(agency);
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (candidates.length === 1) {
|
|
286
|
+
return { ...candidates[0], resolved: true, original: trimmed };
|
|
287
|
+
}
|
|
288
|
+
// 4. No match — return unresolved (pass through to ILIKE)
|
|
289
|
+
return {
|
|
290
|
+
canonical: trimmed,
|
|
291
|
+
fullName: trimmed,
|
|
292
|
+
searchTerms: [lower],
|
|
293
|
+
level: "nyc", // default, doesn't matter for unresolved
|
|
294
|
+
resolved: false,
|
|
295
|
+
original: trimmed,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Get the best filter value to pass to a Supabase RPC.
|
|
300
|
+
*
|
|
301
|
+
* @param prefer - 'checkbook' returns the exact Checkbook agency_name (best for spending/budget RPCs)
|
|
302
|
+
* 'code' returns the 3-digit agency code
|
|
303
|
+
* 'canonical' (default) returns the acronym
|
|
304
|
+
*/
|
|
305
|
+
export function getAgencyFilterValue(resolved, prefer = 'canonical') {
|
|
306
|
+
// Backward compat: true = 'code', false = 'canonical'
|
|
307
|
+
if (prefer === true)
|
|
308
|
+
prefer = 'code';
|
|
309
|
+
if (prefer === false)
|
|
310
|
+
prefer = 'canonical';
|
|
311
|
+
if (prefer === 'checkbook') {
|
|
312
|
+
// Return exact Checkbook name for best matching in spending/budget RPCs
|
|
313
|
+
if (resolved.checkbookName)
|
|
314
|
+
return resolved.checkbookName;
|
|
315
|
+
// Fall back to fullName (works for most agencies where fullName matches Checkbook)
|
|
316
|
+
if (resolved.resolved && resolved.fullName)
|
|
317
|
+
return resolved.fullName;
|
|
318
|
+
return resolved.original;
|
|
319
|
+
}
|
|
320
|
+
if (prefer === 'code' && resolved.code)
|
|
321
|
+
return resolved.code;
|
|
322
|
+
return resolved.resolved ? resolved.canonical : resolved.original;
|
|
323
|
+
}
|
|
324
|
+
//# sourceMappingURL=agency-aliases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agency-aliases.js","sourceRoot":"","sources":["../src/agency-aliases.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,+DAA+D;AAE/D,MAAM,YAAY,GAAiB;IACjC;QACE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,0BAA0B,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;QAClF,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,SAAS,EAAE,cAAc,CAAC;KACvI;IACD;QACE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,+CAA+C,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;QACvG,WAAW,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,+CAA+C,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;KAC9K;IACD;QACE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,yCAAyC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAA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
|
3
|
+
*
|
|
4
|
+
* Shared helpers for consistent MCP tool output formatting.
|
|
5
|
+
* Used by all 33+ tools to standardize responses.
|
|
6
|
+
*/
|
|
7
|
+
/** Truncate a string to maxLen characters, appending "..." if truncated. */
|
|
8
|
+
export declare function truncate(text: string | null | undefined, maxLen?: number): string;
|
|
9
|
+
/** Format a number as USD currency string. Returns "" if null/undefined. */
|
|
10
|
+
export declare function usd(amount: number | string | null | undefined): string;
|
|
11
|
+
/** Format a number with commas. Returns "N/A" if null/undefined. */
|
|
12
|
+
export declare function num(value: number | string | null | undefined): string;
|
|
13
|
+
/** Safely extract YYYY-MM-DD from a date string. Returns null if invalid. */
|
|
14
|
+
export declare function safeDate(dateStr: string | number | null | undefined): string | null;
|
|
15
|
+
/** Safely extract 4-digit year from a date string. Returns null if invalid. */
|
|
16
|
+
export declare function safeYear(dateStr: string | number | null | undefined): number | null;
|
|
17
|
+
export interface McpTextResponse {
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
content: Array<{
|
|
20
|
+
type: "text";
|
|
21
|
+
text: string;
|
|
22
|
+
}>;
|
|
23
|
+
isError?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Build a standard success response. */
|
|
26
|
+
export declare function textResponse(text: string): McpTextResponse;
|
|
27
|
+
/** Build an error response (bad input, missing params, not-found for detail lookups). */
|
|
28
|
+
export declare function errorResponse(message: string): McpTextResponse;
|
|
29
|
+
/**
|
|
30
|
+
* Build an empty-state response (search returned 0 results).
|
|
31
|
+
* NEVER uses isError — empty results are valid, not errors.
|
|
32
|
+
*/
|
|
33
|
+
export declare function emptyResponse(queryEcho: string, suggestion?: string): McpTextResponse;
|
|
34
|
+
/**
|
|
35
|
+
* Build a human-readable query echo from tool args.
|
|
36
|
+
* Filters out null/empty/default values and the `limit` param.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildQueryEcho(args: Record<string, any>): string;
|
|
39
|
+
export interface MetadataOptions {
|
|
40
|
+
showing?: number;
|
|
41
|
+
total?: number;
|
|
42
|
+
source?: string;
|
|
43
|
+
filteredOut?: number;
|
|
44
|
+
filterReason?: string;
|
|
45
|
+
method?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Build a metadata footer line for the --- separator section. */
|
|
48
|
+
export declare function buildMetadata(opts: MetadataOptions): string;
|
|
49
|
+
/**
|
|
50
|
+
* Build the "Explore Further" section with cross-tool suggestions.
|
|
51
|
+
* Pass null/undefined entries — they're filtered out.
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildExploreFurther(suggestions: Array<string | null | undefined>): string;
|
|
54
|
+
/**
|
|
55
|
+
* Build a note when agency input was resolved to canonical form.
|
|
56
|
+
* Returns empty string if no resolution happened.
|
|
57
|
+
*/
|
|
58
|
+
export declare function agencyResolvedNote(resolved: boolean, original: string, canonical: string, fullName: string): string;
|
|
59
|
+
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../src/formatters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,4EAA4E;AAC5E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,GAAE,MAAY,GAAG,MAAM,CAKtF;AAID,4EAA4E;AAC5E,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAKtE;AAED,oEAAoE;AACpE,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAKrE;AAID,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAInF;AAED,+EAA+E;AAC/E,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAA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
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GrantSignal MCP Server — Output Formatting Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared helpers for consistent MCP tool output formatting.
|
|
5
|
+
* Used by all 33+ tools to standardize responses.
|
|
6
|
+
*/
|
|
7
|
+
// ── Truncation ──────────────────────────────────────────────
|
|
8
|
+
/** Truncate a string to maxLen characters, appending "..." if truncated. */
|
|
9
|
+
export function truncate(text, maxLen = 300) {
|
|
10
|
+
if (!text)
|
|
11
|
+
return "";
|
|
12
|
+
const s = String(text);
|
|
13
|
+
if (s.length <= maxLen)
|
|
14
|
+
return s;
|
|
15
|
+
return s.substring(0, maxLen).trimEnd() + "...";
|
|
16
|
+
}
|
|
17
|
+
// ── Currency / Number Formatting ────────────────────────────
|
|
18
|
+
/** Format a number as USD currency string. Returns "" if null/undefined. */
|
|
19
|
+
export function usd(amount) {
|
|
20
|
+
if (amount == null || amount === "")
|
|
21
|
+
return "";
|
|
22
|
+
const n = typeof amount === "string" ? parseFloat(amount) : amount;
|
|
23
|
+
if (isNaN(n))
|
|
24
|
+
return "";
|
|
25
|
+
return `$${n.toLocaleString("en-US", { maximumFractionDigits: 0 })}`;
|
|
26
|
+
}
|
|
27
|
+
/** Format a number with commas. Returns "N/A" if null/undefined. */
|
|
28
|
+
export function num(value) {
|
|
29
|
+
if (value == null || value === "")
|
|
30
|
+
return "N/A";
|
|
31
|
+
const n = typeof value === "string" ? parseFloat(value) : value;
|
|
32
|
+
if (isNaN(n))
|
|
33
|
+
return "N/A";
|
|
34
|
+
return n.toLocaleString("en-US");
|
|
35
|
+
}
|
|
36
|
+
// ── Safe Date Extraction ────────────────────────────────────
|
|
37
|
+
/** Safely extract YYYY-MM-DD from a date string. Returns null if invalid. */
|
|
38
|
+
export function safeDate(dateStr) {
|
|
39
|
+
if (!dateStr || typeof dateStr !== "string")
|
|
40
|
+
return null;
|
|
41
|
+
if (dateStr.length >= 10)
|
|
42
|
+
return dateStr.substring(0, 10);
|
|
43
|
+
return dateStr;
|
|
44
|
+
}
|
|
45
|
+
/** Safely extract 4-digit year from a date string. Returns null if invalid. */
|
|
46
|
+
export function safeYear(dateStr) {
|
|
47
|
+
if (!dateStr || typeof dateStr !== "string" || dateStr.length < 4)
|
|
48
|
+
return null;
|
|
49
|
+
const year = parseInt(dateStr.substring(0, 4), 10);
|
|
50
|
+
return isNaN(year) ? null : year;
|
|
51
|
+
}
|
|
52
|
+
/** Build a standard success response. */
|
|
53
|
+
export function textResponse(text) {
|
|
54
|
+
return { content: [{ type: "text", text }] };
|
|
55
|
+
}
|
|
56
|
+
/** Build an error response (bad input, missing params, not-found for detail lookups). */
|
|
57
|
+
export function errorResponse(message) {
|
|
58
|
+
return { content: [{ type: "text", text: message }], isError: true };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Build an empty-state response (search returned 0 results).
|
|
62
|
+
* NEVER uses isError — empty results are valid, not errors.
|
|
63
|
+
*/
|
|
64
|
+
export function emptyResponse(queryEcho, suggestion) {
|
|
65
|
+
const parts = [
|
|
66
|
+
"No results found.",
|
|
67
|
+
"",
|
|
68
|
+
`> **Search:** ${queryEcho}`,
|
|
69
|
+
];
|
|
70
|
+
if (suggestion) {
|
|
71
|
+
parts.push("", `**Suggestion:** ${suggestion}`);
|
|
72
|
+
}
|
|
73
|
+
return textResponse(parts.join("\n"));
|
|
74
|
+
}
|
|
75
|
+
// ── Query Echo Builder ──────────────────────────────────────
|
|
76
|
+
/**
|
|
77
|
+
* Build a human-readable query echo from tool args.
|
|
78
|
+
* Filters out null/empty/default values and the `limit` param.
|
|
79
|
+
*/
|
|
80
|
+
export function buildQueryEcho(args) {
|
|
81
|
+
const parts = [];
|
|
82
|
+
for (const [key, value] of Object.entries(args)) {
|
|
83
|
+
if (value == null || value === "" || value === false)
|
|
84
|
+
continue;
|
|
85
|
+
if (key === "limit" || key === "includeHistorical" || key === "includeExpired")
|
|
86
|
+
continue;
|
|
87
|
+
if (Array.isArray(value) && value.length === 0)
|
|
88
|
+
continue;
|
|
89
|
+
// Convert camelCase to readable label
|
|
90
|
+
const displayKey = key.replace(/([A-Z])/g, " $1").toLowerCase().trim();
|
|
91
|
+
const displayVal = Array.isArray(value) ? value.join(", ") : String(value);
|
|
92
|
+
parts.push(`${displayKey}: "${displayVal}"`);
|
|
93
|
+
}
|
|
94
|
+
return parts.length > 0 ? parts.join(" | ") : "(no filters)";
|
|
95
|
+
}
|
|
96
|
+
/** Build a metadata footer line for the --- separator section. */
|
|
97
|
+
export function buildMetadata(opts) {
|
|
98
|
+
const parts = [];
|
|
99
|
+
if (opts.showing != null && opts.total != null && opts.total > opts.showing) {
|
|
100
|
+
parts.push(`Showing ${opts.showing} of ${num(opts.total)} results`);
|
|
101
|
+
}
|
|
102
|
+
else if (opts.showing != null) {
|
|
103
|
+
parts.push(`${opts.showing} result(s)`);
|
|
104
|
+
}
|
|
105
|
+
if (opts.filteredOut && opts.filteredOut > 0) {
|
|
106
|
+
parts.push(`${opts.filteredOut} ${opts.filterReason || "results"} filtered out`);
|
|
107
|
+
}
|
|
108
|
+
if (opts.source) {
|
|
109
|
+
parts.push(`Source: ${opts.source}`);
|
|
110
|
+
}
|
|
111
|
+
if (opts.method === "keyword_scored") {
|
|
112
|
+
parts.push("Scoring: keyword-based (AI unavailable)");
|
|
113
|
+
}
|
|
114
|
+
else if (opts.method === "ai_scored") {
|
|
115
|
+
parts.push("Scoring: AI-powered (Claude Haiku)");
|
|
116
|
+
}
|
|
117
|
+
return parts.join(" | ");
|
|
118
|
+
}
|
|
119
|
+
// ── "Explore Further" Suggestions ───────────────────────────
|
|
120
|
+
/**
|
|
121
|
+
* Build the "Explore Further" section with cross-tool suggestions.
|
|
122
|
+
* Pass null/undefined entries — they're filtered out.
|
|
123
|
+
*/
|
|
124
|
+
export function buildExploreFurther(suggestions) {
|
|
125
|
+
const valid = suggestions.filter(Boolean);
|
|
126
|
+
if (valid.length === 0)
|
|
127
|
+
return "";
|
|
128
|
+
return "\n## Explore Further\n" + valid.map(s => `- ${s}`).join("\n");
|
|
129
|
+
}
|
|
130
|
+
// ── Agency Resolution Note ──────────────────────────────────
|
|
131
|
+
/**
|
|
132
|
+
* Build a note when agency input was resolved to canonical form.
|
|
133
|
+
* Returns empty string if no resolution happened.
|
|
134
|
+
*/
|
|
135
|
+
export function agencyResolvedNote(resolved, original, canonical, fullName) {
|
|
136
|
+
if (!resolved)
|
|
137
|
+
return "";
|
|
138
|
+
return `> *Interpreted "${original}" as ${canonical} (${fullName})*\n`;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../src/formatters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,+DAA+D;AAE/D,4EAA4E;AAC5E,MAAM,UAAU,QAAQ,CAAC,IAA+B,EAAE,SAAiB,GAAG;IAC5E,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC;AAClD,CAAC;AAED,+DAA+D;AAE/D,4EAA4E;AAC5E,MAAM,UAAU,GAAG,CAAC,MAA0C;IAC5D,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC/C,MAAM,CAAC,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACnE,IAAI,KAAK,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IACxB,OAAO,IAAI,CAAC,CAAC,cAAc,CAA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