Skip to main content
Glama
manolaz

Emergency Medicare Planner MCP Server

by manolaz

find_nearby_medical_facilities

Locate nearby hospitals and clinics based on user location, treatment needs, care quality, price range, and infrastructure. Designed for emergency medical planning by evaluating facility types and services.

Instructions

Finds hospitals and clinics nearby user location that match specific requirements

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
careQualityNoExpected quality of medical care
facilitiesNoTypes of medical facilities to search for
infrastructureNoQuality of infrastructure and cleanliness
priceRangeNoPrice range preference
radiusNoSearch radius in meters (default: 10000m = 10km)
treatmentNeedsNoSpecific medical treatments or services needed
userLocationYesUser's current location (address or coordinates)

Implementation Reference

  • The main handler function for the 'find_nearby_medical_facilities' tool. It validates input using the schema, uses mock data for nearby facilities, applies filters based on user preferences (treatment needs, care quality, price range, facility types, infrastructure), and returns a formatted list of matching facilities.
    case "find_nearby_medical_facilities": {
      const validatedArgs = FindNearbyMedicalFacilitiesSchema.parse(args);
      
      // Mock implementation - in a real scenario this would call the Google Maps API
      const mockFacilities = [
        {
          name: "General Hospital",
          address: "123 Main St, Cityville",
          distance: "2.3 km",
          type: "hospital",
          treatmentsAvailable: ["emergency", "surgery", "cardiology"],
          careQuality: "high",
          priceRange: "moderate",
          infrastructure: "excellent"
        },
        {
          name: "Community Clinic",
          address: "456 Oak Ave, Cityville",
          distance: "3.8 km",
          type: "clinic",
          treatmentsAvailable: ["general practice", "pediatrics"],
          careQuality: "medium",
          priceRange: "low",
          infrastructure: "good"
        },
        {
          name: "Specialized Medical Center",
          address: "789 Pine St, Cityville",
          distance: "5.1 km",
          type: "specialist",
          treatmentsAvailable: ["oncology", "neurology"],
          careQuality: "high",
          priceRange: "high",
          infrastructure: "excellent"
        }
      ];
      
      // Filter facilities based on user criteria
      let facilities = mockFacilities;
      
      // Filter by treatment needs if specified
      if (validatedArgs.treatmentNeeds && validatedArgs.treatmentNeeds.length > 0) {
        facilities = facilities.filter(facility => 
          validatedArgs.treatmentNeeds!.some(treatment => 
            facility.treatmentsAvailable.includes(treatment)
          )
        );
      }
      
      // Filter by care quality if specified
      if (validatedArgs.careQuality && validatedArgs.careQuality !== "any") {
        facilities = facilities.filter(facility => 
          facility.careQuality === validatedArgs.careQuality ||
          (validatedArgs.careQuality === "high" && facility.careQuality === "high") ||
          (validatedArgs.careQuality === "medium" && ["medium", "high"].includes(facility.careQuality))
        );
      }
      
      // Filter by price range if specified
      if (validatedArgs.priceRange && validatedArgs.priceRange !== "any") {
        facilities = facilities.filter(facility => facility.priceRange === validatedArgs.priceRange);
      }
      
      // Filter by facility type if specified
      if (validatedArgs.facilities && validatedArgs.facilities.length > 0) {
        facilities = facilities.filter(facility => 
          validatedArgs.facilities!.includes(facility.type as any)
        );
      }
      
      // Filter by infrastructure quality if specified
      if (validatedArgs.infrastructure && validatedArgs.infrastructure !== "any") {
        facilities = facilities.filter(facility => 
          facility.infrastructure === validatedArgs.infrastructure ||
          (validatedArgs.infrastructure === "good" && ["good", "excellent"].includes(facility.infrastructure))
        );
      }
      
      return {
        content: [
          {
            type: "text",
            text: `Found ${facilities.length} medical facilities near ${validatedArgs.userLocation} within ${validatedArgs.radius/1000} km:\n\n` +
                  facilities.map(f => 
                    `- ${f.name} (${f.type})\n  Address: ${f.address}\n  Distance: ${f.distance}\n` +
                    `  Treatments: ${f.treatmentsAvailable.join(", ")}\n` +
                    `  Quality: ${f.careQuality}, Price: ${f.priceRange}, Infrastructure: ${f.infrastructure}`
                  ).join("\n\n")
          },
        ],
      };
    }
  • Zod schema defining the input parameters for the 'find_nearby_medical_facilities' tool, including user location, search radius, treatment needs, care quality, price range, facility types, and infrastructure preferences.
    const FindNearbyMedicalFacilitiesSchema = z.object({
      userLocation: z.string().describe("User's current location (address or coordinates)"),
      radius: z.number().default(10000).describe("Search radius in meters (default: 10000m = 10km)"),
      treatmentNeeds: z.array(z.string()).optional().describe("Specific medical treatments or services needed"),
      careQuality: z.enum(["high", "medium", "any"]).optional().describe("Expected quality of medical care"),
      priceRange: z.enum(["low", "moderate", "high", "any"]).optional().describe("Price range preference"),
      facilities: z.array(z.enum(["hospital", "clinic", "emergency", "pharmacy", "specialist"])).optional()
        .describe("Types of medical facilities to search for"),
      infrastructure: z.enum(["excellent", "good", "any"]).optional().describe("Quality of infrastructure and cleanliness"),
    });
  • index.ts:264-268 (registration)
    Registration of the 'find_nearby_medical_facilities' tool in the list of available tools returned by ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: "find_nearby_medical_facilities",
      description: "Finds hospitals and clinics nearby user location that match specific requirements",
      inputSchema: zodToJsonSchema(FindNearbyMedicalFacilitiesSchema),
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'finds' and 'match specific requirements,' implying a read-only search operation, but fails to disclose critical traits: whether it requires authentication, rate limits, data freshness, error handling, or what the output format looks like (no output schema exists). For a tool with 7 parameters and no annotations, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary details. It wastes no words, making it appropriately concise. However, it could be slightly improved by structuring usage hints, but as-is, it's well-sized for its purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (7 parameters, no annotations, no output schema), the description is incomplete. It doesn't address behavioral aspects like authentication or rate limits, lacks output details, and provides no usage context. While the schema covers parameters well, the overall context for an AI agent to use this tool effectively is insufficient, especially for a search tool with multiple filters and no safety annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal value beyond the input schema, which has 100% coverage with detailed parameter descriptions and enums. It mentions 'specific requirements,' hinting at parameters like 'careQuality' or 'treatmentNeeds,' but doesn't explain their semantics or relationships. With high schema coverage, the baseline is 3, as the schema does the heavy lifting, and the description doesn't compensate with additional insights.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Finds hospitals and clinics nearby user location that match specific requirements.' It specifies the verb ('finds'), resource ('hospitals and clinics'), and scope ('nearby user location'), distinguishing it from siblings like 'check_medicare_coverage' or 'schedule_emergency_transport.' However, it doesn't explicitly differentiate from all siblings (e.g., 'get_emergency_contacts' might also involve medical facilities), so it's not a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when-not scenarios (e.g., for non-medical emergencies or when insurance coverage is the primary concern) or explicitly refer to sibling tools like 'check_medicare_coverage' for coverage checks. Usage is implied by the purpose but lacks explicit context, scoring low due to the absence of clear alternatives or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/manolaz/emergency-medicare-planner-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server