/** * Owner-related MCP tools */ import { z } from 'zod'; import { ReonomyClient } from '../client/reonomy-client.js'; const ListPropertyOwnersSchema = z.object({ propertyId: z.string().describe('Unique Reonomy property ID'), page: z.number().optional().describe('Page number for pagination (default: 1)'), limit: z.number().optional().describe('Number of results per page (default: 25, max: 100)'), offset: z.number().optional().describe('Offset for results (alternative to page)'), }); const GetOwnerSchema = z.object({ ownerId: z.string().describe('Unique Reonomy owner ID'), }); const SearchOwnersSchema = z.object({ name: z.string().optional().describe('Owner name or partial name to search'), ownerType: z.string().optional().describe('Type of owner: individual, company, trust, llc, partnership, other'), minProperties: z.number().optional().describe('Minimum number of properties owned'), minValue: z.number().optional().describe('Minimum total value of properties owned in dollars'), page: z.number().optional().describe('Page number for pagination (default: 1)'), limit: z.number().optional().describe('Number of results per page (default: 25, max: 100)'), offset: z.number().optional().describe('Offset for results (alternative to page)'), }); export const ownerTools = [ { name: 'list_property_owners', description: `List all owners of a specific commercial property. Use this tool when you need to: - Identify who owns a particular property - Find ownership percentage for each owner in multi-owner properties - Determine when each owner acquired their stake (acquisition date) - Research ownership structure for due diligence - Contact property owners for acquisition opportunities Returns paginated list of owners associated with the property. Properties may have multiple owners with different ownership percentages.`, inputSchema: ListPropertyOwnersSchema, handler: async (client: ReonomyClient, args: z.infer) => { const { propertyId, ...paginationParams } = args; const result = await client.listPropertyOwners(propertyId, paginationParams); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }, }, { name: 'get_owner', description: `Retrieve detailed information about a specific property owner. Use this tool when you need: - Complete owner profile including name and type (individual, company, trust, LLC, etc.) - Contact information (email, phone, mailing address) - Portfolio information - list of all properties owned - Total number of properties and aggregate value of portfolio - Owner entity classification for investment analysis Ideal for researching major property holders, identifying acquisition targets, or understanding ownership patterns in a market.`, inputSchema: GetOwnerSchema, handler: async (client: ReonomyClient, args: z.infer) => { const result = await client.getOwner(args.ownerId); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }, }, { name: 'search_owners', description: `Search for property owners across the Reonomy database. Use this tool when you need to: - Find owners by name or company name - Identify major property holders (filter by minimum property count) - Discover high-net-worth owners (filter by minimum portfolio value) - Research ownership entities of specific types (LLC, trust, corporation, etc.) - Build target lists for investment marketing or acquisitions - Track ownership patterns and consolidation trends Returns paginated list of owners matching search criteria with portfolio statistics.`, inputSchema: SearchOwnersSchema, handler: async (client: ReonomyClient, args: z.infer) => { const result = await client.searchOwners(args); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }, }, ];