@ratio-mcp/docs-server 1.5.0 → 1.6.0
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/README.md +75 -0
- package/dist/schemas/app-distribution.json +36 -0
- package/dist/schemas/customers.json +26 -0
- package/dist/schemas/discounts.json +81 -0
- package/dist/schemas/draft_orders.json +112 -0
- package/dist/schemas/loyalty.json +147 -0
- package/dist/schemas/orders.json +597 -102
- package/dist/schemas/product_reviews.json +45 -0
- package/dist/schemas/products.json +401 -118
- package/dist/schemas/tags.json +98 -0
- package/dist/schemas/variants.json +112 -0
- package/dist/schemas/webhooks.json +94 -15
- package/dist/tools/get-api-reference.d.ts.map +1 -1
- package/dist/tools/get-api-reference.js +4 -1
- package/dist/tools/get-api-reference.js.map +1 -1
- package/dist/tools/get-scope-map.d.ts.map +1 -1
- package/dist/tools/get-scope-map.js +7 -1
- package/dist/tools/get-scope-map.js.map +1 -1
- package/dist/tools/get-scopes.d.ts +3 -0
- package/dist/tools/get-scopes.d.ts.map +1 -1
- package/dist/tools/get-scopes.js +13 -2
- package/dist/tools/get-scopes.js.map +1 -1
- package/dist/tools/lookup-docs.d.ts +1 -1
- package/dist/tools/lookup-docs.d.ts.map +1 -1
- package/dist/tools/lookup-docs.js +27 -4
- package/dist/tools/lookup-docs.js.map +1 -1
- package/dist/tools/validate-code.d.ts.map +1 -1
- package/dist/tools/validate-code.js +0 -4
- package/dist/tools/validate-code.js.map +1 -1
- package/dist/utils/schema-loader.d.ts +5 -1
- package/dist/utils/schema-loader.d.ts.map +1 -1
- package/dist/utils/schema-loader.js +8 -2
- package/dist/utils/schema-loader.js.map +1 -1
- package/package.json +3 -3
- package/dist/schemas/schemas/oauth.json +0 -71
- package/dist/schemas/schemas/orders.json +0 -167
- package/dist/schemas/schemas/products.json +0 -167
- package/dist/schemas/schemas/scopes.json +0 -52
- package/dist/schemas/schemas/webhooks.json +0 -69
- package/dist/schemas/scopes.json +0 -52
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resource": "tags",
|
|
3
|
+
"auth": {
|
|
4
|
+
"type": "bearer",
|
|
5
|
+
"header": "Authorization",
|
|
6
|
+
"format": "Bearer <access_token>"
|
|
7
|
+
},
|
|
8
|
+
"common_headers": {
|
|
9
|
+
"gk-merchant-id": "Required. Tenant/merchant context for the request."
|
|
10
|
+
},
|
|
11
|
+
"notes": "Order tags. These endpoints reuse the ORDER scopes: read_orders for reads, order-create for writes (NOT a separate tags scope).",
|
|
12
|
+
"endpoints": [
|
|
13
|
+
{
|
|
14
|
+
"method": "POST",
|
|
15
|
+
"path": "/api/v1/tags",
|
|
16
|
+
"controller_order": 1,
|
|
17
|
+
"handler_name": "create",
|
|
18
|
+
"required_scope": "order-create",
|
|
19
|
+
"summary": "Create a tag",
|
|
20
|
+
"request_body": {
|
|
21
|
+
"content_type": "application/json",
|
|
22
|
+
"fields": [
|
|
23
|
+
{ "name": "name", "type": "string", "required": true, "description": "Tag name" },
|
|
24
|
+
{ "name": "is_active", "type": "boolean", "required": false, "default": true, "description": "Whether the tag is active" }
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"response_schema": "Tag"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"method": "GET",
|
|
31
|
+
"path": "/api/v1/tags",
|
|
32
|
+
"controller_order": 2,
|
|
33
|
+
"handler_name": "getTags",
|
|
34
|
+
"required_scope": "read_orders",
|
|
35
|
+
"summary": "List tags",
|
|
36
|
+
"query_params": [
|
|
37
|
+
{ "name": "is_active", "type": "boolean", "required": false, "description": "Filter by active state" },
|
|
38
|
+
{ "name": "search", "type": "string", "required": false, "description": "Search by tag name" }
|
|
39
|
+
],
|
|
40
|
+
"request_body": null,
|
|
41
|
+
"response_schema": "TagListResponse"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"method": "GET",
|
|
45
|
+
"path": "/api/v1/tags/:id",
|
|
46
|
+
"controller_order": 3,
|
|
47
|
+
"handler_name": "getTagById",
|
|
48
|
+
"required_scope": "read_orders",
|
|
49
|
+
"summary": "Get a tag by ID",
|
|
50
|
+
"path_params": [
|
|
51
|
+
{ "name": "id", "type": "string", "required": true, "description": "The tag ID" }
|
|
52
|
+
],
|
|
53
|
+
"request_body": null,
|
|
54
|
+
"response_schema": "Tag"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"method": "PUT",
|
|
58
|
+
"path": "/api/v1/tags/:id",
|
|
59
|
+
"controller_order": 4,
|
|
60
|
+
"handler_name": "updateTag",
|
|
61
|
+
"required_scope": "order-create",
|
|
62
|
+
"summary": "Update a tag",
|
|
63
|
+
"path_params": [
|
|
64
|
+
{ "name": "id", "type": "string", "required": true, "description": "The tag ID to update" }
|
|
65
|
+
],
|
|
66
|
+
"request_body": {
|
|
67
|
+
"content_type": "application/json",
|
|
68
|
+
"fields": [
|
|
69
|
+
{ "name": "name", "type": "string", "required": false },
|
|
70
|
+
{ "name": "is_active", "type": "boolean", "required": false }
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"response_schema": "Tag"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"method": "DELETE",
|
|
77
|
+
"path": "/api/v1/tags/:id",
|
|
78
|
+
"controller_order": 5,
|
|
79
|
+
"handler_name": "deleteTag",
|
|
80
|
+
"required_scope": "order-create",
|
|
81
|
+
"summary": "Delete a tag",
|
|
82
|
+
"path_params": [
|
|
83
|
+
{ "name": "id", "type": "string", "required": true, "description": "The tag ID to delete" }
|
|
84
|
+
],
|
|
85
|
+
"request_body": null,
|
|
86
|
+
"response_schema": "Tag"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"schemas": {
|
|
90
|
+
"Tag": {
|
|
91
|
+
"id": "string — tag identifier",
|
|
92
|
+
"name": "string — tag name",
|
|
93
|
+
"is_active": "boolean",
|
|
94
|
+
"created_at": "string — ISO 8601",
|
|
95
|
+
"updated_at": "string — ISO 8601"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resource": "variants",
|
|
3
|
+
"auth": {
|
|
4
|
+
"type": "bearer",
|
|
5
|
+
"header": "Authorization",
|
|
6
|
+
"format": "Bearer <access_token>"
|
|
7
|
+
},
|
|
8
|
+
"common_headers": {
|
|
9
|
+
"gk-merchant-id": "Required. Tenant/merchant context for the request."
|
|
10
|
+
},
|
|
11
|
+
"notes": "Product variants (sub-resource of products). Uses product scopes: read_products for reads, write_products for writes. Paths carry a doubled /v1 segment (global /api/v1 prefix + controller 'v1/variants').",
|
|
12
|
+
"endpoints": [
|
|
13
|
+
{
|
|
14
|
+
"method": "GET",
|
|
15
|
+
"path": "/api/v1/v1/variants",
|
|
16
|
+
"controller_order": 1,
|
|
17
|
+
"handler_name": "findAll",
|
|
18
|
+
"required_scope": "read_products",
|
|
19
|
+
"summary": "List variants",
|
|
20
|
+
"query_params": [
|
|
21
|
+
{ "name": "product_id", "type": "string", "required": false, "description": "Filter by product" },
|
|
22
|
+
{ "name": "limit", "type": "number", "required": false },
|
|
23
|
+
{ "name": "offset", "type": "number", "required": false }
|
|
24
|
+
],
|
|
25
|
+
"request_body": null,
|
|
26
|
+
"response_schema": "VariantListResponse"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"method": "GET",
|
|
30
|
+
"path": "/api/v1/v1/variants/:id",
|
|
31
|
+
"controller_order": 2,
|
|
32
|
+
"handler_name": "findOne",
|
|
33
|
+
"required_scope": "read_products",
|
|
34
|
+
"summary": "Get a variant by ID",
|
|
35
|
+
"path_params": [
|
|
36
|
+
{ "name": "id", "type": "string", "required": true, "description": "The variant ID" }
|
|
37
|
+
],
|
|
38
|
+
"request_body": null,
|
|
39
|
+
"response_schema": "Variant"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"method": "DELETE",
|
|
43
|
+
"path": "/api/v1/v1/variants/:id",
|
|
44
|
+
"controller_order": 3,
|
|
45
|
+
"handler_name": "remove",
|
|
46
|
+
"required_scope": "write_products",
|
|
47
|
+
"summary": "Delete a variant",
|
|
48
|
+
"path_params": [
|
|
49
|
+
{ "name": "id", "type": "string", "required": true, "description": "The variant ID to delete" }
|
|
50
|
+
],
|
|
51
|
+
"request_body": null,
|
|
52
|
+
"response_schema": "Variant"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"method": "PUT",
|
|
56
|
+
"path": "/api/v1/v1/variants/:id",
|
|
57
|
+
"controller_order": 4,
|
|
58
|
+
"handler_name": "update",
|
|
59
|
+
"required_scope": "write_products",
|
|
60
|
+
"summary": "Update a variant",
|
|
61
|
+
"path_params": [
|
|
62
|
+
{ "name": "id", "type": "string", "required": true, "description": "The variant ID to update" }
|
|
63
|
+
],
|
|
64
|
+
"request_body": {
|
|
65
|
+
"content_type": "application/json",
|
|
66
|
+
"fields": [
|
|
67
|
+
{ "name": "title", "type": "string", "required": false },
|
|
68
|
+
{ "name": "sku", "type": "string", "required": false },
|
|
69
|
+
{ "name": "price", "type": "number", "required": false },
|
|
70
|
+
{ "name": "cost", "type": "number", "required": false },
|
|
71
|
+
{ "name": "inventory", "type": "number", "required": false, "description": "Inventory quantity" }
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"response_schema": "Variant"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"method": "POST",
|
|
78
|
+
"path": "/api/v1/v1/variants/:productId",
|
|
79
|
+
"controller_order": 5,
|
|
80
|
+
"handler_name": "create",
|
|
81
|
+
"required_scope": "write_products",
|
|
82
|
+
"summary": "Create a variant for a product",
|
|
83
|
+
"path_params": [
|
|
84
|
+
{ "name": "productId", "type": "string", "required": true, "description": "The product to attach the variant to" }
|
|
85
|
+
],
|
|
86
|
+
"request_body": {
|
|
87
|
+
"content_type": "application/json",
|
|
88
|
+
"fields": [
|
|
89
|
+
{ "name": "title", "type": "string", "required": false },
|
|
90
|
+
{ "name": "sku", "type": "string", "required": false },
|
|
91
|
+
{ "name": "price", "type": "number", "required": false },
|
|
92
|
+
{ "name": "cost", "type": "number", "required": false },
|
|
93
|
+
{ "name": "inventory", "type": "number", "required": false, "description": "Inventory quantity" }
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"response_schema": "Variant"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"schemas": {
|
|
100
|
+
"Variant": {
|
|
101
|
+
"id": "string — variant identifier",
|
|
102
|
+
"product_id": "string",
|
|
103
|
+
"title": "string | null",
|
|
104
|
+
"sku": "string | null",
|
|
105
|
+
"price": "number",
|
|
106
|
+
"cost": "number | null",
|
|
107
|
+
"inventory": "number — inventory quantity",
|
|
108
|
+
"created_at": "string — ISO 8601",
|
|
109
|
+
"updated_at": "string — ISO 8601"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -1,64 +1,143 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version":
|
|
2
|
+
"version": 2,
|
|
3
3
|
"verification": {
|
|
4
4
|
"method": "HMAC-SHA256",
|
|
5
|
-
"header": "X-
|
|
6
|
-
"description": "Verify
|
|
5
|
+
"header": "X-Webhook-Signature",
|
|
6
|
+
"description": "Verify authenticity by computing HMAC-SHA256 of the raw request body using your app's webhook secret (returned once when the webhook is created). The computed digest must equal the X-Webhook-Signature header. Each delivery also carries X-Webhook-Id, X-Webhook-Topic, and X-Merchant-Id headers."
|
|
7
7
|
},
|
|
8
8
|
"retry_policy": {
|
|
9
9
|
"max_retries": 3,
|
|
10
|
-
"retry_intervals": ["
|
|
11
|
-
"
|
|
10
|
+
"retry_intervals": ["1s", "5s", "30s"],
|
|
11
|
+
"timeout": "30s",
|
|
12
|
+
"failure_action": "Webhook is auto-disabled after 10 consecutive failed deliveries"
|
|
12
13
|
},
|
|
13
14
|
"events": [
|
|
14
15
|
{
|
|
15
16
|
"topic": "orders/create",
|
|
16
|
-
"description": "
|
|
17
|
+
"description": "Triggered when a new order is placed",
|
|
17
18
|
"resource": "orders",
|
|
18
19
|
"required_scope": "read_orders"
|
|
19
20
|
},
|
|
20
21
|
{
|
|
21
22
|
"topic": "orders/updated",
|
|
22
|
-
"description": "
|
|
23
|
+
"description": "Triggered when an order is updated",
|
|
23
24
|
"resource": "orders",
|
|
24
25
|
"required_scope": "read_orders"
|
|
25
26
|
},
|
|
26
27
|
{
|
|
27
|
-
"topic": "orders/
|
|
28
|
-
"description": "
|
|
28
|
+
"topic": "orders/paid",
|
|
29
|
+
"description": "Triggered when an order is paid",
|
|
29
30
|
"resource": "orders",
|
|
30
31
|
"required_scope": "read_orders"
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
34
|
"topic": "orders/fulfilled",
|
|
34
|
-
"description": "
|
|
35
|
+
"description": "Triggered when an order is fully fulfilled",
|
|
35
36
|
"resource": "orders",
|
|
36
37
|
"required_scope": "read_orders"
|
|
37
38
|
},
|
|
38
39
|
{
|
|
39
|
-
"topic": "orders/
|
|
40
|
-
"description": "
|
|
40
|
+
"topic": "orders/cancelled",
|
|
41
|
+
"description": "Triggered when an order is cancelled",
|
|
42
|
+
"resource": "orders",
|
|
43
|
+
"required_scope": "read_orders"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"topic": "orders/partially_fulfilled",
|
|
47
|
+
"description": "Triggered when an order is partially fulfilled",
|
|
48
|
+
"resource": "orders",
|
|
49
|
+
"required_scope": "read_orders"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"topic": "orders/delete",
|
|
53
|
+
"description": "Triggered when an order is deleted",
|
|
54
|
+
"resource": "orders",
|
|
55
|
+
"required_scope": "read_orders"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"topic": "orders/edited",
|
|
59
|
+
"description": "Triggered when an order is edited",
|
|
41
60
|
"resource": "orders",
|
|
42
61
|
"required_scope": "read_orders"
|
|
43
62
|
},
|
|
44
63
|
{
|
|
45
64
|
"topic": "products/create",
|
|
46
|
-
"description": "
|
|
65
|
+
"description": "Triggered when a new product is created",
|
|
47
66
|
"resource": "products",
|
|
48
67
|
"required_scope": "read_products"
|
|
49
68
|
},
|
|
50
69
|
{
|
|
51
70
|
"topic": "products/update",
|
|
52
|
-
"description": "
|
|
71
|
+
"description": "Triggered when a product is updated",
|
|
53
72
|
"resource": "products",
|
|
54
73
|
"required_scope": "read_products"
|
|
55
74
|
},
|
|
56
75
|
{
|
|
57
76
|
"topic": "products/delete",
|
|
58
|
-
"description": "
|
|
77
|
+
"description": "Triggered when a product is deleted",
|
|
59
78
|
"resource": "products",
|
|
60
79
|
"required_scope": "read_products"
|
|
61
80
|
},
|
|
81
|
+
{
|
|
82
|
+
"topic": "customers/create",
|
|
83
|
+
"description": "Triggered when a new customer is created",
|
|
84
|
+
"resource": "customers",
|
|
85
|
+
"required_scope": "read_customers"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"topic": "customers/update",
|
|
89
|
+
"description": "Triggered when customer information is updated",
|
|
90
|
+
"resource": "customers",
|
|
91
|
+
"required_scope": "read_customers"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"topic": "customers/delete",
|
|
95
|
+
"description": "Triggered when a customer is deleted",
|
|
96
|
+
"resource": "customers",
|
|
97
|
+
"required_scope": "read_customers"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"topic": "collections/create",
|
|
101
|
+
"description": "Triggered when a new collection is created",
|
|
102
|
+
"resource": "collections",
|
|
103
|
+
"required_scope": "read_products"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"topic": "collections/update",
|
|
107
|
+
"description": "Triggered when a collection is updated",
|
|
108
|
+
"resource": "collections",
|
|
109
|
+
"required_scope": "read_products"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"topic": "collections/delete",
|
|
113
|
+
"description": "Triggered when a collection is deleted",
|
|
114
|
+
"resource": "collections",
|
|
115
|
+
"required_scope": "read_products"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"topic": "loyalty/points_credited",
|
|
119
|
+
"description": "Triggered when a customer's loyalty point balance increases (earn, admin credit, refund/reversal credit)",
|
|
120
|
+
"resource": "loyalty",
|
|
121
|
+
"required_scope": "read_loyalty"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"topic": "loyalty/points_debited",
|
|
125
|
+
"description": "Triggered when a customer's loyalty point balance decreases (redeem, admin debit, cancellation/reversal debit, expiry)",
|
|
126
|
+
"resource": "loyalty",
|
|
127
|
+
"required_scope": "read_loyalty"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"topic": "reviews/create",
|
|
131
|
+
"description": "Triggered when a customer submits a product review",
|
|
132
|
+
"resource": "reviews",
|
|
133
|
+
"required_scope": "read_products"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"topic": "reviews/update",
|
|
137
|
+
"description": "Triggered when a merchant moderates or edits a review (hide, show, archive, edit)",
|
|
138
|
+
"resource": "reviews",
|
|
139
|
+
"required_scope": "read_products"
|
|
140
|
+
},
|
|
62
141
|
{
|
|
63
142
|
"topic": "app/uninstalled",
|
|
64
143
|
"description": "Fired when the app is uninstalled by a merchant",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-api-reference.d.ts","sourceRoot":"","sources":["../../src/tools/get-api-reference.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-api-reference.d.ts","sourceRoot":"","sources":["../../src/tools/get-api-reference.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDjF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RATIO_API_BASE_URL } from '@ratio-mcp/shared';
|
|
1
2
|
import { loadResourceSchema, getAvailableResourceFiles } from '../utils/schema-loader.js';
|
|
2
3
|
/**
|
|
3
4
|
* get_api_reference — Returns complete API reference for a resource.
|
|
@@ -29,7 +30,9 @@ export function getApiReference(input) {
|
|
|
29
30
|
endpoints = [...endpoints].sort((a, b) => a.controller_order - b.controller_order);
|
|
30
31
|
return {
|
|
31
32
|
resource: schema.resource,
|
|
32
|
-
|
|
33
|
+
// Env-specific (per-branch default + RATIO_API_BASE_URL env override) —
|
|
34
|
+
// never baked into the generated schema files, which are env-neutral.
|
|
35
|
+
base_url: RATIO_API_BASE_URL,
|
|
33
36
|
auth: schema.auth,
|
|
34
37
|
endpoint_count: endpoints.length,
|
|
35
38
|
endpoints: endpoints.map((ep) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-api-reference.js","sourceRoot":"","sources":["../../src/tools/get-api-reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAE1F;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAkD;IAChF,MAAM,kBAAkB,GAAG,yBAAyB,EAAE,CAAC;IAEvD,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjD,OAAO;YACL,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,sBAAsB,KAAK,CAAC,QAAQ,GAAG;YAChD,mBAAmB,EAAE,kBAAkB;SACxC,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAElD,IAAI,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IAEjC,8BAA8B;IAC9B,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,cAAc,KAAK,KAAK,CAAC,Y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OAAO;YACnB,WAAW,EAAE,EAAE,CAAC,WAAW;YAC3B,YAAY,EAAE,EAAE,CAAC,YAAY,IAAI,EAAE;YACnC,WAAW,EAAE,EAAE,CAAC,WAAW,IAAI,EAAE;YACjC,YAAY,EAAE,EAAE,CAAC,YAAY,IAAI,IAAI;YACrC,eAAe,EAAE,EAAE,CAAC,eAAe,IAAI,IAAI;SAC5C,CAAC,CAAC;QACH,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE;QAC/B,oBAAoB,EAAE,KAAK,CAAC,YAAY,IAAI,IAAI;KACjD,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-scope-map.d.ts","sourceRoot":"","sources":["../../src/tools/get-scope-map.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AA6B9D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE;;;;;;
|
|
1
|
+
{"version":3,"file":"get-scope-map.d.ts","sourceRoot":"","sources":["../../src/tools/get-scope-map.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AA6B9D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE;;;;;;EAsF9D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadResourceSchema } from '../utils/schema-loader.js';
|
|
1
|
+
import { loadResourceSchema, getAvailableResourceFiles } from '../utils/schema-loader.js';
|
|
2
2
|
/**
|
|
3
3
|
* Resolve scope inheritance:
|
|
4
4
|
* - write_X includes read_X
|
|
@@ -56,7 +56,13 @@ export function getScopeEndpointMap(input) {
|
|
|
56
56
|
}
|
|
57
57
|
// Group endpoints by resource
|
|
58
58
|
const endpointsByResource = new Map();
|
|
59
|
+
// Only attempt resources that actually have a schema file. The resource-name
|
|
60
|
+
// extraction above can produce candidates that don't exist (e.g. 'order' from
|
|
61
|
+
// the hyphenated 'order-create' scope); filtering here avoids noisy load errors.
|
|
62
|
+
const availableResources = new Set(getAvailableResourceFiles());
|
|
59
63
|
for (const resourceName of resourceNames) {
|
|
64
|
+
if (!availableResources.has(resourceName))
|
|
65
|
+
continue;
|
|
60
66
|
try {
|
|
61
67
|
const resourceSchema = loadResourceSchema(resourceName);
|
|
62
68
|
const matchingEndpoints = resourceSchema.endpoints
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-scope-map.js","sourceRoot":"","sources":["../../src/tools/get-scope-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"get-scope-map.js","sourceRoot":"","sources":["../../src/tools/get-scope-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAG1F;;;;;;GAMG;AACH,SAAS,sBAAsB,CAAC,MAAgB;IAC9C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,CAAC;IAEzC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC7C,QAAQ,CAAC,GAAG,CAAC,QAAQ,QAAQ,EAAE,CAAC,CAAC;QACnC,CAAC;aAAM,IAAI,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;YAC9C,QAAQ,CAAC,GAAG,CAAC,S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CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,GAAG,CAAC,CAAC,gBAAgB,CAAC,CAAC;QACjF,MAAM,CAAC,IAAI,CAAC;YACV,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC/B,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;gBACxD,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC;YAC5C,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACb,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,MAAM;SAClB,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,gBAAgB,EAAE,KAAK,CAAC,MAAM;QAC9B,eAAe,EAAE,CAAC,GAAG,cAAc,CAAC;QACpC,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QACvE,QAAQ,EAAE,MAAM;QAChB,YAAY,EAAE,4EAA4E;KAC3F,CAAC;AACJ,CAAC"}
|
|
@@ -10,6 +10,7 @@ export declare function getAvailableScopes(input: {
|
|
|
10
10
|
message: string;
|
|
11
11
|
available_resources: string[];
|
|
12
12
|
resource?: undefined;
|
|
13
|
+
codegen_ready?: undefined;
|
|
13
14
|
resource_info?: undefined;
|
|
14
15
|
scopes?: undefined;
|
|
15
16
|
total?: undefined;
|
|
@@ -19,6 +20,7 @@ export declare function getAvailableScopes(input: {
|
|
|
19
20
|
_instruction?: undefined;
|
|
20
21
|
} | {
|
|
21
22
|
resource: string;
|
|
23
|
+
codegen_ready: boolean;
|
|
22
24
|
resource_info: {
|
|
23
25
|
description: string;
|
|
24
26
|
codegen_ready: boolean;
|
|
@@ -56,6 +58,7 @@ export declare function getAvailableScopes(input: {
|
|
|
56
58
|
message?: undefined;
|
|
57
59
|
available_resources?: undefined;
|
|
58
60
|
resource?: undefined;
|
|
61
|
+
codegen_ready?: undefined;
|
|
59
62
|
resource_info?: undefined;
|
|
60
63
|
scopes?: undefined;
|
|
61
64
|
total?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-scopes.d.ts","sourceRoot":"","sources":["../../src/tools/get-scopes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-scopes.d.ts","sourceRoot":"","sources":["../../src/tools/get-scopes.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuE9D"}
|
package/dist/tools/get-scopes.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { SCOPES_BY_RESOURCE, PRIMARY_RESOURCES, RESOURCE_METADATA, getAllResources } from '@ratio-mcp/shared';
|
|
2
|
+
import { getAvailableResourceFiles } from '../utils/schema-loader.js';
|
|
3
|
+
/**
|
|
4
|
+
* codegen_ready is DERIVED from schema presence, not a hand-maintained flag:
|
|
5
|
+
* generate_api_routes can scaffold any resource that has an endpoint schema file.
|
|
6
|
+
* This keeps it accurate + zero-maintenance as resources are added/synced.
|
|
7
|
+
*/
|
|
8
|
+
function codegenReadyResources() {
|
|
9
|
+
return new Set(getAvailableResourceFiles());
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* get_available_scopes — Returns all available scopes grouped by primary resource.
|
|
4
13
|
* Returns all scopes from the platform grouped by resource.
|
|
5
14
|
* Data sourced from GET /api/v1/scopes — all 147 scopes across 78 resources.
|
|
6
15
|
*/
|
|
7
16
|
export function getAvailableScopes(input) {
|
|
17
|
+
const codegenReady = codegenReadyResources();
|
|
8
18
|
if (input.resource) {
|
|
9
19
|
const resourceScopes = SCOPES_BY_RESOURCE[input.resource];
|
|
10
20
|
const resourceMeta = RESOURCE_METADATA[input.resource];
|
|
@@ -17,10 +27,11 @@ export function getAvailableScopes(input) {
|
|
|
17
27
|
}
|
|
18
28
|
return {
|
|
19
29
|
resource: input.resource,
|
|
30
|
+
codegen_ready: codegenReady.has(input.resource),
|
|
20
31
|
resource_info: resourceMeta
|
|
21
32
|
? {
|
|
22
33
|
description: resourceMeta.description,
|
|
23
|
-
codegen_ready:
|
|
34
|
+
codegen_ready: codegenReady.has(input.resource),
|
|
24
35
|
commonly_needed_with: resourceMeta.commonly_needed_with,
|
|
25
36
|
example_app_types: resourceMeta.example_app_types,
|
|
26
37
|
}
|
|
@@ -41,7 +52,7 @@ export function getAvailableScopes(input) {
|
|
|
41
52
|
return {
|
|
42
53
|
resource: resourceName,
|
|
43
54
|
description: meta?.description || '',
|
|
44
|
-
codegen_ready:
|
|
55
|
+
codegen_ready: codegenReady.has(resourceName),
|
|
45
56
|
is_primary: primarySet.has(resourceName),
|
|
46
57
|
scopes: scopes.map((s) => ({
|
|
47
58
|
code: s.code,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-scopes.js","sourceRoot":"","sources":["../../src/tools/get-scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-scopes.js","sourceRoot":"","sources":["../../src/tools/get-scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9G,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;;GAIG;AACH,SAAS,qBAAqB;IAC5B,OAAO,IAAI,GAAG,CAAC,yBAAyB,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FAAyF;YACzF,6GAA6G;KAChH,CAAC;AACJ,CAAC"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
interface SearchResult {
|
|
12
12
|
source: string;
|
|
13
|
-
type: 'api_endpoint' | 'scope' | 'webhook_event' | 'oauth' | 'resource';
|
|
13
|
+
type: 'api_endpoint' | 'scope' | 'webhook_event' | 'oauth' | 'resource' | 'app_distribution';
|
|
14
14
|
relevance: 'high' | 'medium' | 'low';
|
|
15
15
|
data: Record<string, unknown>;
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup-docs.d.ts","sourceRoot":"","sources":["../../src/tools/lookup-docs.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,cAAc,GAAG,OAAO,GAAG,eAAe,GAAG,OAAO,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"lookup-docs.d.ts","sourceRoot":"","sources":["../../src/tools/lookup-docs.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,cAAc,GAAG,OAAO,GAAG,eAAe,GAAG,OAAO,GAAG,UAAU,GAAG,kBAAkB,CAAC;IAC7F,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AA+LD,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8DrE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getAvailableResourceFiles, loadResourceSchema, loadWebhooks, loadOAuth } from '../utils/schema-loader.js';
|
|
2
|
-
import { SCOPES_BY_RESOURCE, PRIMARY_RESOURCES
|
|
1
|
+
import { getAvailableResourceFiles, loadResourceSchema, loadWebhooks, loadOAuth, loadAppDistribution } from '../utils/schema-loader.js';
|
|
2
|
+
import { SCOPES_BY_RESOURCE, PRIMARY_RESOURCES } from '@ratio-mcp/shared';
|
|
3
3
|
import { logger } from '../utils/logger.js';
|
|
4
4
|
/**
|
|
5
5
|
* Search-term aliases — map common synonyms to platform terminology.
|
|
@@ -85,8 +85,8 @@ function searchApiEndpoints(tokens) {
|
|
|
85
85
|
}
|
|
86
86
|
function searchScopes(tokens) {
|
|
87
87
|
const results = [];
|
|
88
|
+
const codegenReady = new Set(getAvailableResourceFiles()); // derived from schema presence
|
|
88
89
|
for (const [resource, scopes] of Object.entries(SCOPES_BY_RESOURCE)) {
|
|
89
|
-
const meta = RESOURCE_METADATA[resource];
|
|
90
90
|
for (const scope of scopes) {
|
|
91
91
|
const searchText = `${scope.code} ${scope.label} ${resource}`;
|
|
92
92
|
const score = matchScore(tokens, searchText);
|
|
@@ -99,7 +99,7 @@ function searchScopes(tokens) {
|
|
|
99
99
|
code: scope.code,
|
|
100
100
|
label: scope.label,
|
|
101
101
|
resource,
|
|
102
|
-
codegen_ready:
|
|
102
|
+
codegen_ready: codegenReady.has(resource),
|
|
103
103
|
},
|
|
104
104
|
});
|
|
105
105
|
}
|
|
@@ -156,6 +156,26 @@ function searchOAuth(tokens) {
|
|
|
156
156
|
}
|
|
157
157
|
return results;
|
|
158
158
|
}
|
|
159
|
+
function searchAppDistribution(tokens) {
|
|
160
|
+
const results = [];
|
|
161
|
+
try {
|
|
162
|
+
const dist = loadAppDistribution();
|
|
163
|
+
const text = JSON.stringify(dist).toLowerCase();
|
|
164
|
+
const score = matchScore(tokens, text);
|
|
165
|
+
if (score > 0) {
|
|
166
|
+
results.push({
|
|
167
|
+
source: 'app-distribution',
|
|
168
|
+
type: 'app_distribution',
|
|
169
|
+
relevance: score >= 2 ? 'high' : 'medium',
|
|
170
|
+
data: dist,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
// Skip if app-distribution schema fails
|
|
176
|
+
}
|
|
177
|
+
return results;
|
|
178
|
+
}
|
|
159
179
|
export function lookupDocs(input) {
|
|
160
180
|
const { query, category } = input;
|
|
161
181
|
logger.info(`[lookup_docs] query="${query}", category="${category || 'all'}"`);
|
|
@@ -181,6 +201,9 @@ export function lookupDocs(input) {
|
|
|
181
201
|
if (!category || category === 'oauth') {
|
|
182
202
|
results.push(...searchOAuth(tokens));
|
|
183
203
|
}
|
|
204
|
+
if (!category) {
|
|
205
|
+
results.push(...searchAppDistribution(tokens));
|
|
206
|
+
}
|
|
184
207
|
// Sort by relevance (high first) then deduplicate
|
|
185
208
|
results.sort((a, b) => {
|
|
186
209
|
const order = { high: 0, medium: 1, low: 2 };
|