search_by_pi
MCP Tool
Search tool that lists the NSF awards led by a Principal Investigator, optionally merged with the awards where the same person is a Co-PI.
search_by_pi lists the NSF awards led by a Principal Investigator. The last name is required. First name,
institution, state, start and expiration date ranges and status narrow the search.1
By default it runs one API search on the PI’s name and pages like the other search tools. With
includeCoPIs: true it also finds awards where the person is a Co-PI, current or former. The API cannot page the
union of a PI search and a Co-PI search, so in that mode the server fetches both result sets in full (at most 250
matches each), merges them, keeps only awards that name the person, sorts them, and pages the merged list
itself.1 2
The description that clients see in tools/list is:1
List NSF awards led by a Principal Investigator (last name required; first name, institution and state narrow it). With includeCoPIs, also lists awards where the person is a Co-PI. Returns up to 25 compact summaries per call, newest first; page with offset/nextOffset.
Schema
Descriptions are the exact strings in the Zod schema.3 The tool also takes offset, limit, detail,
printFields, status, startDateFrom, startDateTo, expDateFrom and expDateTo, which are documented in
Shared search parameters. It has no amount filters.
| Parameter | Type | Required | Default | Constraints | NSF API parameter | Description |
|---|---|---|---|---|---|---|
lastName |
string | yes | trimmed; at least 1 character | alone: pdPIName and piLastName; with firstName: part of pdPIName; with includeCoPIs, also part of coPDPI |
Principal Investigator last name (required). Alone, it matches every PI with that surname | |
firstName |
string | no | none | trimmed; at least 1 character when given | part of pdPIName; with includeCoPIs, also part of coPDPI |
First name; searched together with lastName as the PI’s full name |
institution |
string | no | none | quoted by the client when it has a space | awardeeName |
Awardee institution name, matched as a phrase |
stateCode |
string | no | none | awardeeStateCode |
Awardee two-letter state code | |
includeCoPIs |
boolean | no | false |
none (selects the merged search) | Also include awards where the person is a Co-PI. Merges two searches (up to 250 matches each), so give firstName, institution or a date range for common surnames |
A blank firstName (only spaces) is rejected rather than ignored.4 The date ranges and status map as
on the shared page. offset and limit are sent as offset and rpp only in the
default mode. With includeCoPIs, the tool’s offset and limit are not passed to the API (the client pages through each full
result set itself). They slice the merged list.1 5 6
Output
The same search envelope as the other search tools: awards, totalResults, offset, limit, returned,
hasMore, nextOffset (when hasMore), capped, pageSummary and the paging hint.7 See
Search results.
With includeCoPIs, totalResults is the number of awards in the merged list, not an API count, and hasMore is
true while offset + returned is below that number.1 2 Because each side is limited to 250
matches, the merged count stays far below 10,000 and capped is false.
Default mode: PI search
Without includeCoPIs, the handler makes one API request with the name parameters, the filters, offset and
rpp. piNameParams picks the name parameters:1
| Input | NSF API parameters |
|---|---|
firstName and lastName |
pdPIName="<firstName> <lastName>", unquoted |
lastName alone |
pdPIName=<lastName> and piLastName=<lastName> |
The tool does not send piFirstName. On the live API, pdPIName matches whole words of the PI’s name, so a full
name finds that person. piLastName is a prefix match: Roos also finds every PI named Roosevelt. piFirstName is
fuzzy, so piFirstName plus piLastName can return other people whose surname starts with the searched
one.1 8 For a surname alone, pdPIName plus piLastName keeps only whole-word
matches that are also surnames, so Roos no longer finds the Roosevelts. The live MCP suite checks that every award
a Christopher Roos search returns has both words in pdPIName.8 9
Merged mode: includeCoPIs
With includeCoPIs: true the handler works like this:1
- It runs two searches in parallel with the same filters (
awardeeName,awardeeStateCode, the date ranges and the status flag):- a PI search with the same name parameters as the default mode (
pdPIName, pluspiLastNamewhen no first name is given); - a Co-PI search with
coPDPIset to"firstName lastName", or to the last name alone when no first name is given.
- a PI search with the same name parameters as the default mode (
- Each search goes through the client’s
searchAllPages. It fetches a first page of 25. If the API reports more than 250 matches, it fails. Otherwise it fetches the rest, usually in one large request.6 - The handler combines both lists, drops duplicate award IDs, and keeps only awards that name the person.
- It sorts the merged list by start date, newest first. Ties are broken by award ID, higher first, and undated awards come last, so the merged list pages the same way every time.5
- It returns the slice from
offsettooffset + limit.
Name check. The Co-PI search is loose on the API: a last name alone matches every Co-PI with that
surname.10 So each merged award is checked against the name. The name words (first and last) must all appear among
the words of one person on the award: pdPIName, a pi entry or a coPDPI entry. Both sides are split into words
the same way: the name is normalized to Unicode NFC and lower-cased, a typographic apostrophe (’ or ‘) becomes a
plain ', and the text is split at spaces, commas, periods, parentheses, hyphens and dashes.1
Consequences, all covered by tests:5
- Without
firstName, every award whose PI or Co-PI has that surname is kept, whoever the person is. - A former Co-PI still matches; the summary shows the name with ` (Former)`.
- Whole words must match: a search for “Smith” does not keep a person named “Smithson”, and a nickname does not match a full first name.
- Hyphenated surnames match:
Jimenez-Sandoval(orJimenezorSandovalalone) matches a PI listed asSaul JIMENEZ-SANDOVAL, butJimenez-Lopezdoes not. Before hyphens were split, such a person’s own PI awards were dropped from the merged list. O'BrienandO’Brienmatch each other.
The 250 limit. If either search matches more than 250 awards, the call fails with this error (the number is the API’s match count):6
Search matches 300 awards, more than the 250 that can be merged; narrow it (e.g. add firstName, institution, stateCode or a date range)
For common surnames, add firstName plus institution or a date range.2
Cache. Each full result set is cached for 5 minutes by default, so paging through a merged result does not fetch
it again. NSF_API_CACHE_TTL_MS sets the lifetime, and 0 disables the cache. Concurrent calls for the same search
share one fetch, a failed fetch is never cached, and cancelling one call only abandons that call’s
wait.6 11 See Configuration and
NSF API client.
If either search fails, the whole call fails with that error.5
Examples
A PI search in the default mode:
{ "lastName": "Smith", "firstName": "Ann", "stateCode": "AZ", "status": "active" }
The handler sends pdPIName=Ann Smith, awardeeStateCode=AZ, ActiveAwards=true, offset=0 and rpp=25 in one
request.1 With lastName alone it would send pdPIName=Smith and piLastName=Smith.
The same person, including Co-PI awards:
{ "lastName": "Smith", "firstName": "Ann", "includeCoPIs": true }
The handler runs two full searches: one with pdPIName=Ann Smith, one with coPDPI=Ann Smith.1 In the offline test for this call, the mocked PI search returns awards 3000001 and
3000002 (both starting 01/01/2020) and 3000009 (no start date). The mocked Co-PI search returns 3000003 (starting
12/31/2019), where Ann Smith is a Co-PI. The abridged merged result:5
{
"awards": [
{ "id": "3000002", "startDate": "01/01/2020", "...": "..." },
{ "id": "3000001", "startDate": "01/01/2020", "...": "..." },
{ "id": "3000003", "startDate": "12/31/2019", "...": "..." },
{ "id": "3000009", "...": "..." }
],
"totalResults": 4,
"offset": 0,
"limit": 25,
"returned": 4,
"hasMore": false,
"capped": false,
"pageSummary": { "...": "..." },
"hint": "Showing 4 of 4 matching awards (offset 0)."
}