get_rent_estimates
Estimate monthly rental prices for properties using location details, property characteristics, and market data to determine fair market rent values.
Instructions
Get long-term rent estimates with comparable rental properties. This tool helps you estimate monthly rental prices for properties based on location, property characteristics, and market data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | No | Full property address (e.g., '1011 W 23rd St, Apt 101, Austin, TX 78705') | |
| bathrooms | No | Number of bathrooms (e.g., 1, 1.5, 2) | |
| bedrooms | No | Number of bedrooms (e.g., 1, 2, 3) | |
| latitude | No | Property latitude coordinate (e.g., 30.287007) | |
| longitude | No | Property longitude coordinate (e.g., -97.748941) | |
| propertyId | No | Unique property identifier from Rentcast database (e.g., '12345') | |
| propertyType | No | Type of property (e.g., 'Apartment', 'House', 'Condo', 'Townhouse') | |
| squareFootage | No | Property size in square feet (e.g., 450, 1200, 2000) |
Implementation Reference
- src/index.ts:516-648 (handler)Primary MCP server tool registration and handler for 'get_rent_estimates'. Validates input parameters using RentEstimateSchema, builds API request params, calls rentcastAPI.getRentEstimates(), processes the response data including comparables, formats a comprehensive user-friendly output with estimates, ranges, and suggestions.server.tool( "get_rent_estimates", "Get long-term rent estimates with comparable rental properties. This tool helps you estimate monthly rental prices for properties based on location, property characteristics, and market data.", RentEstimateSchema.shape, async (params: z.infer<typeof RentEstimateSchema>) => { try { // Validate parameters using Zod schema const validatedParams = RentEstimateSchema.parse(params); // Build search parameters for rent estimates const searchParams: Record<string, any> = {}; if (validatedParams.propertyId) searchParams.propertyId = validatedParams.propertyId; if (validatedParams.address) searchParams.address = validatedParams.address; if (validatedParams.latitude) searchParams.latitude = validatedParams.latitude; if (validatedParams.longitude) searchParams.longitude = validatedParams.longitude; if (validatedParams.propertyType) searchParams.propertyType = validatedParams.propertyType; if (validatedParams.bedrooms) searchParams.bedrooms = validatedParams.bedrooms; if (validatedParams.bathrooms) searchParams.bathrooms = validatedParams.bathrooms; if (validatedParams.squareFootage) searchParams.squareFootage = validatedParams.squareFootage; // Additional validation to ensure we have required parameters if (!searchParams.propertyId && !searchParams.address && (!searchParams.latitude || !searchParams.longitude)) { return createErrorResponse( "β **Missing Required Parameters for Rent Estimates**\n\n" + "π‘ **You must provide ONE of the following options:**\n\n" + "**Option 1: Property Address**\n" + "β’ `address`: Full property address (e.g., '1011 W 23rd St, Apt 101, Austin, TX 78705')\n\n" + "**Option 2: GPS Coordinates**\n" + "β’ `latitude`: Property latitude (e.g., 30.287007)\n" + "β’ `longitude`: Property longitude (e.g., -97.748941)\n\n" + "**Option 3: Property ID**\n" + "β’ `propertyId`: Unique identifier from Rentcast database\n\n" + "π **Optional Parameters (improve accuracy):**\n" + "β’ `propertyType`: Apartment, House, Condo, etc.\n" + "β’ `bedrooms`: Number of bedrooms\n" + "β’ `bathrooms`: Number of bathrooms\n" + "β’ `squareFootage`: Property size in sq ft\n\n" + "π **Example Usage:**\n" + "```json\n" + "{\n" + ' "address": "1011 W 23rd St, Apt 101, Austin, TX 78705",\n' + ' "propertyType": "Apartment",\n' + ' "bedrooms": 1,\n' + ' "bathrooms": 1,\n' + ' "squareFootage": 450\n' + "}\n" + "```" ); } const result = await rentcastAPI.getRentEstimates(searchParams); if (!result.success) { return createErrorResponse("Error getting rent estimates", result.error); } const rentData = result.data as RentEstimateResponse; if (!rentData) { return createErrorResponse("No rent estimate data found"); } // Format the response let resultText = `π **Rent Estimate Results**\n\n`; // Add usage tips resultText += `π‘ **Tool Usage Tips:**\n`; resultText += `β’ Use this tool to estimate monthly rental prices for properties\n`; resultText += `β’ Provide more details (bedrooms, bathrooms, square footage) for better accuracy\n`; resultText += `β’ Results include comparable properties for market analysis\n\n`; // Property identification if (rentData.address) { resultText += `π **Property:** ${rentData.address}\n`; } if (rentData.propertyType) { resultText += `π **Type:** ${rentData.propertyType}\n`; } if (rentData.bedrooms !== undefined) { resultText += `ποΈ **Bedrooms:** ${rentData.bedrooms}\n`; } if (rentData.bathrooms !== undefined) { resultText += `πΏ **Bathrooms:** ${rentData.bathrooms}\n`; } if (rentData.squareFootage) { resultText += `π **Square Footage:** ${rentData.squareFootage.toLocaleString()} sqft\n`; } resultText += `\nπ° **Estimated Monthly Rent:** `; if (rentData.rent) { resultText += `$${Number(rentData.rent).toLocaleString()}/month`; // Add rent range if available if (rentData.rentRangeLow && rentData.rentRangeHigh) { resultText += `\nπ **Rent Range:** $${Number(rentData.rentRangeLow).toLocaleString()} - $${Number(rentData.rentRangeHigh).toLocaleString()}/month`; } } else { resultText += `N/A`; } // Add comparables if available if (rentData.comparables && rentData.comparables.length > 0) { resultText += `\n\nποΈ **Comparable Properties:**\n`; rentData.comparables.slice(0, 5).forEach((comp, index) => { resultText += `\n${index + 1}. **${comp.address}**\n`; resultText += ` π° Rent: $${Number(comp.rent).toLocaleString()}/month`; if (comp.bedrooms !== undefined) resultText += ` | ποΈ ${comp.bedrooms} bed`; if (comp.bathrooms !== undefined) resultText += ` | πΏ ${comp.bathrooms} bath`; if (comp.squareFootage) resultText += ` | π ${comp.squareFootage.toLocaleString()} sqft`; if (comp.distance) resultText += ` | π ${comp.distance.toFixed(1)} miles away`; }); } // Add helpful footer resultText += `\n\nπ **Need More Data?**\n`; resultText += `β’ Use \`get_property_details\` to get comprehensive property information\n`; resultText += `β’ Use \`get_rental_listings\` to see actual rental listings in the area\n`; resultText += `β’ Use \`analyze_market\` to understand rental market trends\n\n`; return createSuccessResponse(resultText); } catch (error) { if (error instanceof z.ZodError) { const errorDetails = error.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', '); return createErrorResponse(`Invalid parameters: ${errorDetails}`); } return createErrorResponse("Failed to get rent estimates", error instanceof Error ? error.message : 'Unknown error'); } } );
- src/services/rentcast-api.ts:150-167 (handler)Core service method implementing the Rentcast API call for long-term rent estimates. Makes authenticated GET request to '/avm/rent/long-term' endpoint with provided property parameters and returns ApiCallResult.async getRentEstimates( params: { propertyId?: string; address?: string; latitude?: number; longitude?: number; propertyType?: string; bedrooms?: number; bathrooms?: number; squareFootage?: number; } = {}, ): Promise<ApiCallResult> { const result = await this.makeRequest<RentcastAVM>( "/avm/rent/long-term", params, ); return result; }
- src/types/index.ts:450-462 (schema)Zod schema defining input parameters for the get_rent_estimates tool, including optional fields for property identification (propertyId, address, lat/lng) and characteristics (type, beds, baths, sqft) with descriptions.export const RentEstimateSchema = z.object({ // Required parameters (at least one) propertyId: z.string().optional().describe("Unique property identifier from Rentcast database (e.g., '12345')"), address: z.string().optional().describe("Full property address (e.g., '1011 W 23rd St, Apt 101, Austin, TX 78705')"), latitude: z.number().optional().describe("Property latitude coordinate (e.g., 30.287007)"), longitude: z.number().optional().describe("Property longitude coordinate (e.g., -97.748941)"), // Optional parameters for better accuracy propertyType: z.string().optional().describe("Type of property (e.g., 'Apartment', 'House', 'Condo', 'Townhouse')"), bedrooms: z.number().optional().describe("Number of bedrooms (e.g., 1, 2, 3)"), bathrooms: z.number().optional().describe("Number of bathrooms (e.g., 1, 1.5, 2)"), squareFootage: z.number().optional().describe("Property size in square feet (e.g., 450, 1200, 2000)"), });
- src/types/index.ts:467-489 (schema)TypeScript interface defining the expected response structure from the rent estimate API call, including estimated rent, range, comparables array, and echoed input parameters.export interface RentEstimateResponse { rent?: number; rentRangeLow?: number; rentRangeHigh?: number; comparables?: Array<{ address: string; rent: number; bedrooms?: number; bathrooms?: number; squareFootage?: number; propertyType?: string; distance?: number; }>; propertyId?: string; address?: string; latitude?: number; longitude?: number; propertyType?: string; bedrooms?: number; bathrooms?: number; squareFootage?: number; }