Humanlearning commited on
Commit
1cc51a2
·
1 Parent(s): 1a0d97d

feat: Add `tools.py` for NPI API integration to search and retrieve provider details.

Browse files
Files changed (1) hide show
  1. src/npi_mcp_server/tools.py +3 -0
src/npi_mcp_server/tools.py CHANGED
@@ -37,6 +37,8 @@ async def search_providers(
37
 
38
  # Remove None values
39
  payload = {k: v for k, v in payload.items() if v is not None}
 
 
40
 
41
  async with httpx.AsyncClient() as client:
42
  try:
@@ -44,6 +46,7 @@ async def search_providers(
44
  response.raise_for_status()
45
 
46
  data = response.json()
 
47
  # Expecting: { "results": [ ... ] }
48
  return SearchProvidersResponse(**data).results
49
 
 
37
 
38
  # Remove None values
39
  payload = {k: v for k, v in payload.items() if v is not None}
40
+
41
+ logger.info(f"Searching providers with payload: {payload}")
42
 
43
  async with httpx.AsyncClient() as client:
44
  try:
 
46
  response.raise_for_status()
47
 
48
  data = response.json()
49
+ logger.info(f"Received response from NPI API: {len(data.get('results', []))} results found.")
50
  # Expecting: { "results": [ ... ] }
51
  return SearchProvidersResponse(**data).results
52