evimnet-mcp 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.js +2 -0
- package/tools/agent.js +98 -5
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -66,6 +66,8 @@ const TOOL_HANDLERS = {
|
|
|
66
66
|
get_my_listings: (a) => handleAgentTool('get_my_listings', a),
|
|
67
67
|
get_listing_analytics: (a) => handleAgentTool('get_listing_analytics', a),
|
|
68
68
|
get_my_stats: (a) => handleAgentTool('get_my_stats', a),
|
|
69
|
+
create_listing: (a) => handleAgentTool('create_listing', a),
|
|
70
|
+
update_listing: (a) => handleAgentTool('update_listing', a),
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
// ─── Server oluştur ──────────────────────────────────────────────────────────
|
package/tools/agent.js
CHANGED
|
@@ -103,15 +103,98 @@ Filtreleme: durum (NEW=Yeni, CONTACTED=Arandı, MEETING=Görüşme, CLOSED=Kapan
|
|
|
103
103
|
properties: {},
|
|
104
104
|
},
|
|
105
105
|
},
|
|
106
|
+
|
|
107
|
+
{
|
|
108
|
+
name: 'create_listing',
|
|
109
|
+
description: `Yeni ilan oluştur. Şehir ve ilçe adını Türkçe yazabilirsiniz, otomatik eşleştirilir.
|
|
110
|
+
Taslak olarak oluşturulur; panelden fotoğraf ekleyip onaya gönderebilirsiniz. status: "PENDING" ile direkt onaya da gönderilebilir.
|
|
111
|
+
Örnek: "Bodrum Yalıkavak'ta 3+1 villa ekle, 4.500.000 TL, 180m², deniz manzaralı"`,
|
|
112
|
+
inputSchema: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
properties: {
|
|
115
|
+
title: { type: 'string', description: 'İlan başlığı' },
|
|
116
|
+
type: { type: 'string', enum: ['SALE', 'RENT'], description: 'SALE=Satılık, RENT=Kiralık' },
|
|
117
|
+
propertyType: { type: 'string', enum: ['APARTMENT', 'VILLA', 'LAND', 'PROJECT'], description: 'Mülk tipi' },
|
|
118
|
+
priceTRY: { type: 'number', description: 'Fiyat (TRY)' },
|
|
119
|
+
city: { type: 'string', description: 'Şehir adı (ör: Bodrum, İstanbul, Antalya)' },
|
|
120
|
+
district: { type: 'string', description: 'İlçe adı (ör: Yalıkavak, Beşiktaş)' },
|
|
121
|
+
rooms: { type: 'string', description: 'Oda sayısı (ör: 3+1, 2+1, Stüdyo)' },
|
|
122
|
+
sqmNet: { type: 'number', description: 'Net m²' },
|
|
123
|
+
sqmGross: { type: 'number', description: 'Brüt m²' },
|
|
124
|
+
bathrooms: { type: 'number', description: 'Banyo sayısı' },
|
|
125
|
+
floor: { type: 'number', description: 'Bulunduğu kat' },
|
|
126
|
+
totalFloors: { type: 'number', description: 'Toplam kat' },
|
|
127
|
+
buildingAge: { type: 'number', description: 'Bina yaşı' },
|
|
128
|
+
heating: { type: 'string', description: 'Isıtma tipi (ör: Doğalgaz, Klima, Yerden)' },
|
|
129
|
+
description: { type: 'string', description: 'İlan açıklaması (Türkçe)' },
|
|
130
|
+
descriptionDE: { type: 'string', description: 'İlan açıklaması (Almanca, opsiyonel)' },
|
|
131
|
+
viewType: { type: 'string', description: 'Manzara tipi JSON array (ör: ["SEA","NATURE"])' },
|
|
132
|
+
seaDistance: { type: 'number', description: 'Denize uzaklık (metre)' },
|
|
133
|
+
villaType: { type: 'string', enum: ['DETACHED', 'SEMI_DETACHED', 'TRIPLEX', 'DUPLEX'], description: 'Villa tipi' },
|
|
134
|
+
poolType: { type: 'string', enum: ['PRIVATE', 'SHARED', 'NONE'], description: 'Havuz tipi' },
|
|
135
|
+
gardenSqm: { type: 'number', description: 'Bahçe m²' },
|
|
136
|
+
lat: { type: 'number', description: 'Enlem' },
|
|
137
|
+
lng: { type: 'number', description: 'Boylam' },
|
|
138
|
+
features: { type: 'object', description: 'Özellikler (ör: {"barbeku": true, "klima": true})' },
|
|
139
|
+
status: { type: 'string', enum: ['DRAFT', 'PENDING'], description: 'DRAFT=Taslak, PENDING=Onaya gönder' },
|
|
140
|
+
},
|
|
141
|
+
required: ['title', 'type', 'propertyType', 'priceTRY', 'city'],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
{
|
|
146
|
+
name: 'update_listing',
|
|
147
|
+
description: `Mevcut bir ilanı düzenle. Sadece değişen alanları gönderin.
|
|
148
|
+
Fiyat, açıklama, m², oda sayısı vb. güncellenebilir. İçerik değişirse ilan otomatik onaya gider.
|
|
149
|
+
Örnek: "Yalıkavak villamın fiyatını 4 milyona düşür", "İlan açıklamasını güncelle"`,
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: 'object',
|
|
152
|
+
properties: {
|
|
153
|
+
id: { type: 'string', description: 'İlan ID (get_my_listings\'ten alınır)' },
|
|
154
|
+
title: { type: 'string', description: 'Yeni başlık' },
|
|
155
|
+
priceTRY: { type: 'number', description: 'Yeni fiyat (TRY)' },
|
|
156
|
+
description: { type: 'string', description: 'Yeni açıklama' },
|
|
157
|
+
descriptionDE: { type: 'string', description: 'Almanca açıklama' },
|
|
158
|
+
rooms: { type: 'string', description: 'Oda sayısı' },
|
|
159
|
+
sqmNet: { type: 'number', description: 'Net m²' },
|
|
160
|
+
sqmGross: { type: 'number', description: 'Brüt m²' },
|
|
161
|
+
bathrooms: { type: 'number', description: 'Banyo sayısı' },
|
|
162
|
+
floor: { type: 'number', description: 'Kat' },
|
|
163
|
+
buildingAge: { type: 'number', description: 'Bina yaşı' },
|
|
164
|
+
heating: { type: 'string', description: 'Isıtma tipi' },
|
|
165
|
+
viewType: { type: 'string', description: 'Manzara tipi' },
|
|
166
|
+
seaDistance: { type: 'number', description: 'Denize uzaklık' },
|
|
167
|
+
features: { type: 'object', description: 'Özellikler' },
|
|
168
|
+
status: { type: 'string', enum: ['DRAFT', 'PENDING', 'PASSIVE'], description: 'Durum' },
|
|
169
|
+
},
|
|
170
|
+
required: ['id'],
|
|
171
|
+
},
|
|
172
|
+
},
|
|
106
173
|
];
|
|
107
174
|
|
|
108
175
|
export async function handleAgentTool(name, args) {
|
|
109
|
-
if (name === 'get_my_leads')
|
|
110
|
-
if (name === 'get_lead_detail')
|
|
111
|
-
if (name === 'update_lead_status')
|
|
112
|
-
if (name === 'get_my_listings')
|
|
176
|
+
if (name === 'get_my_leads') return getMyLeads(args);
|
|
177
|
+
if (name === 'get_lead_detail') return getLeadDetail(args);
|
|
178
|
+
if (name === 'update_lead_status') return updateLeadStatus(args);
|
|
179
|
+
if (name === 'get_my_listings') return getMyListings(args);
|
|
113
180
|
if (name === 'get_listing_analytics') return getListingAnalytics(args);
|
|
114
|
-
if (name === 'get_my_stats')
|
|
181
|
+
if (name === 'get_my_stats') return getMyStats();
|
|
182
|
+
if (name === 'create_listing') return createListing(args);
|
|
183
|
+
if (name === 'update_listing') return updateListing(args);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async function mcpPost(action, body) {
|
|
187
|
+
const qs = new URLSearchParams({ action });
|
|
188
|
+
const res = await fetch(`${BASE_URL}/api/mcp/agent?${qs}`, {
|
|
189
|
+
method: 'POST',
|
|
190
|
+
headers: agentHeaders(),
|
|
191
|
+
body: JSON.stringify(body),
|
|
192
|
+
});
|
|
193
|
+
if (!res.ok) {
|
|
194
|
+
const data = await res.json().catch(() => ({}));
|
|
195
|
+
throw new Error(data.error || `API hatasi: ${res.status}`);
|
|
196
|
+
}
|
|
197
|
+
return res.json();
|
|
115
198
|
}
|
|
116
199
|
|
|
117
200
|
async function mcpGet(action, params = {}) {
|
|
@@ -175,3 +258,13 @@ async function getMyStats() {
|
|
|
175
258
|
const data = await mcpGet('stats');
|
|
176
259
|
return textResult(data);
|
|
177
260
|
}
|
|
261
|
+
|
|
262
|
+
async function createListing(args) {
|
|
263
|
+
const data = await mcpPost('create-listing', args);
|
|
264
|
+
return textResult(data);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
async function updateListing(args) {
|
|
268
|
+
const data = await mcpPatch('update-listing', args);
|
|
269
|
+
return textResult(data);
|
|
270
|
+
}
|