@enfyra/mcp-server 0.0.62 → 0.0.63
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
CHANGED
package/src/lib/mcp-examples.js
CHANGED
|
@@ -249,7 +249,7 @@ create_column({
|
|
|
249
249
|
},
|
|
250
250
|
'queries-deep': {
|
|
251
251
|
title: 'REST queries, filters, meta counts, and deep relation fetches',
|
|
252
|
-
useWhen: 'Use when fetching records, filtering by relations, loading nested data, or counting efficiently.',
|
|
252
|
+
useWhen: 'Use when fetching records, filtering by relations, loading nested relation data in the same request, or counting efficiently.',
|
|
253
253
|
examples: [
|
|
254
254
|
{
|
|
255
255
|
name: 'Minimal MCP query then explicit detail query',
|
|
@@ -310,14 +310,33 @@ GET /enfyra/post?filter={"<primaryKeyFromMetadata>":{"_eq":123}}&limit=1`,
|
|
|
310
310
|
],
|
|
311
311
|
},
|
|
312
312
|
{
|
|
313
|
-
name: '
|
|
313
|
+
name: 'Relation fields without deep',
|
|
314
314
|
code: `query_table({
|
|
315
315
|
tableName: "order",
|
|
316
|
-
fields: [
|
|
316
|
+
fields: [
|
|
317
|
+
"id",
|
|
318
|
+
"total",
|
|
319
|
+
"customer.id",
|
|
320
|
+
"customer.email",
|
|
321
|
+
"customer.displayName"
|
|
322
|
+
],
|
|
323
|
+
limit: 20
|
|
324
|
+
})`,
|
|
325
|
+
notes: [
|
|
326
|
+
'Use fields with dotted relation paths when you only need scalar fields from related records.',
|
|
327
|
+
'This is enough for simple many-to-one or one-to-one relation display such as owner.email, customer.name, or lastMessage.text.',
|
|
328
|
+
'Do not add deep when fields alone can express the relation data you need.',
|
|
329
|
+
],
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: 'Deep relation query options',
|
|
333
|
+
code: `query_table({
|
|
334
|
+
tableName: "order",
|
|
335
|
+
fields: ["id", "total"],
|
|
317
336
|
deep: JSON.stringify({
|
|
318
|
-
customer: { fields: "id,email,displayName" },
|
|
319
337
|
items: {
|
|
320
338
|
fields: "id,quantity,product",
|
|
339
|
+
sort: "-createdAt",
|
|
321
340
|
limit: 20,
|
|
322
341
|
deep: {
|
|
323
342
|
product: { fields: "id,name,price" }
|
|
@@ -326,6 +345,11 @@ GET /enfyra/post?filter={"<primaryKeyFromMetadata>":{"_eq":123}}&limit=1`,
|
|
|
326
345
|
})
|
|
327
346
|
})`,
|
|
328
347
|
notes: [
|
|
348
|
+
'Use deep when relation loading needs query options such as filter, sort, limit, page, or nested deep.',
|
|
349
|
+
'Deep is mainly useful for controlled child collections or nested relation fetches, not for basic related-field display.',
|
|
350
|
+
'Do not use deep just to filter by a relation id; use a normal relation filter instead.',
|
|
351
|
+
'Do not use deep for counts; use count_records or meta=filterCount/totalCount.',
|
|
352
|
+
'Do not deep-load large child collections without an explicit limit/page. For heavy screens, fetch the parent list first, then load the selected child collection separately with pagination.',
|
|
329
353
|
'Use query_table deep for normal MCP reads; use test_rest_endpoint only when you need a custom raw URL or route behavior test.',
|
|
330
354
|
'deep keys must be relation property names.',
|
|
331
355
|
'Allowed deep options are fields, filter, sort, limit, page, and deep.',
|
|
@@ -240,6 +240,7 @@ export function buildMcpServerInstructions(apiBaseUrl) {
|
|
|
240
240
|
'- Full filter operators: `_eq`, `_neq`, `_gt`, `_gte`, `_lt`, `_lte`, `_in`, `_not_in`, `_nin`, `_contains`, `_starts_with`, `_ends_with`, `_between`, `_is_null`, `_is_not_null`, `_and`, `_or`, `_not`.',
|
|
241
241
|
'- Field permission condition DSL is narrower and does not support `_contains`, `_starts_with`, `_ends_with`, or `_between`.',
|
|
242
242
|
'- Deep shape: `{ relationName: { fields?, filter?, sort?, limit?, page?, deep? } }`. Relation keys are relation `propertyName`, not physical FK columns.',
|
|
243
|
+
'- Use dotted relation fields such as `owner.email` or `lastMessage.text` when the caller only needs basic related record fields. Use `deep` when relation loading needs query options such as `filter`, `sort`, `limit`, `page`, or nested `deep`. Do not use `deep` for simple relation-id filters, one-row lookup, counts, or large child collections that should be loaded separately with pagination.',
|
|
243
244
|
'- Deep validation rejects unknown relation keys, unknown subkeys, `limit` on many-to-one/one-to-one, and invalid dotted sort through many-side relations.',
|
|
244
245
|
'- To count records over REST, do not fetch full rows. Use MCP **`count_records`**, or call `GET /<table>?fields=id&limit=1&meta=totalCount` without filter and read `meta.totalCount`; with a filter use `meta=filterCount` and read `meta.filterCount`.',
|
|
245
246
|
'- In custom dynamic code, use the same lightweight pattern: `const result = await @REPOS.main.find({ fields: "id", limit: 1, meta: filter ? "filterCount" : "totalCount", ...(filter ? { filter } : {}) }); const count = filter ? result.meta?.filterCount : result.meta?.totalCount;`.',
|