Skip to main content
Glama
tandat8503

Rentcast MCP Server

by tandat8503

get_random_properties

Retrieve random property data including price history, lot size, and year built for market analysis. Specify location and quantity (up to 50 properties) to generate sample datasets for real estate research.

Instructions

Get random properties with comprehensive info (default: 10, max: 50 for free tier) for market analysis including price history, lot size, and year built

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityNoCity for random property selection
limitNoNumber of random properties to return (default: 10, max: 50 for free tier)
stateNoState for random property selection
zipCodeNoZIP code for random property selection

Implementation Reference

  • Inline async handler function for the get_random_properties MCP tool. Builds search parameters, calls rentcastAPI.getRandomProperties, processes and formats up to 5 sample properties using formatPropertyInfo, and returns a formatted text response.
    async (params) => {
      try {
        const searchParams = buildPropertySearchParams(params);
        
        const result = await rentcastAPI.getRandomProperties(searchParams);
    
        if (!result.success) {
          return createErrorResponse("Error getting random properties", result.error);
        }
    
        const properties = result.data as any[];
        
    
        
        const summary = `Retrieved ${properties.length} random properties`;
        
        // Process each property individually
        const sampleProperties = properties.slice(0, 5).map(prop => {
          
          return formatPropertyInfo(prop);
        }).join('\n\n');
    
        const resultText = `${summary}\n\nSample Properties:\n\n${sampleProperties}${properties.length > 5 ? '\n\n... and more properties available' : ''}`;
        return createSuccessResponse(resultText);
    
            } catch (error) {
          return createErrorResponse("Failed to get random properties", error instanceof Error ? error.message : 'Unknown error');
        }
    }
  • src/index.ts:366-399 (registration)
    MCP server.tool registration for the 'get_random_properties' tool, specifying name, description, input schema (RandomPropertiesSchema.shape), and inline handler function.
    server.tool(
      "get_random_properties",
      "Get random properties with comprehensive info (default: 10, max: 50 for free tier) for market analysis including price history, lot size, and year built",
      RandomPropertiesSchema.shape,
      async (params) => {
        try {
          const searchParams = buildPropertySearchParams(params);
          
          const result = await rentcastAPI.getRandomProperties(searchParams);
    
          if (!result.success) {
            return createErrorResponse("Error getting random properties", result.error);
          }
    
          const properties = result.data as any[];
          
    
          
          const summary = `Retrieved ${properties.length} random properties`;
          
          // Process each property individually
          const sampleProperties = properties.slice(0, 5).map(prop => {
            
            return formatPropertyInfo(prop);
          }).join('\n\n');
    
          const resultText = `${summary}\n\nSample Properties:\n\n${sampleProperties}${properties.length > 5 ? '\n\n... and more properties available' : ''}`;
          return createSuccessResponse(resultText);
    
              } catch (error) {
            return createErrorResponse("Failed to get random properties", error instanceof Error ? error.message : 'Unknown error');
          }
      }
    );
  • Zod schema defining input parameters for the get_random_properties tool: optional city, state, zipCode, and limit (default 10, max 50).
    export const RandomPropertiesSchema = z.object({
      city: z.string().optional().describe("City for random property selection"),
      state: z.string().optional().describe("State for random property selection"),
      zipCode: z
        .string()
        .optional()
        .describe("ZIP code for random property selection"),
      limit: z
        .number()
        .min(1)
        .max(50)
        .default(10)
        .describe(
          "Number of random properties to return (default: 10, max: 50 for free tier)",
        ),
    });
  • RentcastAPI service method getRandomProperties: constructs API request to Rentcast /properties/random endpoint with location params and limit (default 10), using makeRequest helper for HTTP call and error handling.
    async getRandomProperties(
      params: {
        city?: string;
        state?: string;
        zipCode?: string;
        limit?: number;
      } = {},
    ): Promise<ApiCallResult> {
      const result = await this.makeRequest<RentcastProperty[]>(
        "/properties/random",
        {
          ...params,
          limit: params.limit || 10, // Default to 10 for free tier optimization
        },
      );
      return result;
    }
  • buildPropertySearchParams utility function: maps tool input parameters to API search parameters, optionally including limit.
    function buildPropertySearchParams(params: any, includeLimit: boolean = true): any {
      const searchParams: any = {};
      
      if (includeLimit && params.limit) {
        searchParams.limit = params.limit;
      }
      
      if (params.city) searchParams.city = params.city;
      if (params.state) searchParams.state = params.state;
      if (params.zipCode) searchParams.zipCode = params.zipCode;
      if (params.bedrooms) searchParams.bedrooms = params.bedrooms;
      if (params.bathrooms) searchParams.bathrooms = params.bathrooms;
      if (params.propertyType) searchParams.propertyType = params.propertyType;
      
      return searchParams;
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: the tool returns 'random properties', includes 'comprehensive info' like 'price history, lot size, and year built', and mentions rate limits ('max: 50 for free tier'). However, it doesn't cover aspects like authentication needs, error handling, or response format, leaving gaps for a tool with no output schema.

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 and includes key details like defaults and limits. It avoids redundancy, though it could be slightly more structured by separating usage context from parameter info.

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

Completeness3/5

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

Given no annotations and no output schema, the description is moderately complete for a tool with 4 parameters and 100% schema coverage. It covers purpose, key behavior, and parameter hints, but lacks details on output format, error cases, or deeper usage scenarios, which would be helpful for an AI agent.

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?

Schema description coverage is 100%, so the schema already documents all four parameters. The description adds marginal value by reinforcing the 'limit' parameter's default and max values, but doesn't provide additional semantic context beyond what's in the schema, such as how 'city', 'state', and 'zipCode' interact or affect randomness.

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: 'Get random properties with comprehensive info' for 'market analysis'. It specifies the verb ('Get'), resource ('random properties'), and scope ('market analysis'), though it doesn't explicitly differentiate from siblings like 'search_properties' or 'get_property_details' beyond the 'random' aspect.

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

Usage Guidelines3/5

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

The description implies usage for 'market analysis' and mentions default/max limits, but doesn't provide explicit guidance on when to use this tool versus alternatives like 'search_properties' or 'get_property_details'. It hints at context with 'free tier' but lacks clear when-to-use or when-not-to-use statements.

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

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/tandat8503/mcp_rentcast'

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