@mieubrisse/notion-mcp-server 2.0.0 → 2.0.2
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
|
@@ -1109,63 +1109,7 @@
|
|
|
1109
1109
|
"properties": {
|
|
1110
1110
|
"description": "The property values to update for the page. The keys are the names or IDs of the property and the values are property values. If a page property ID is not included, then it is not changed.",
|
|
1111
1111
|
"type": "object",
|
|
1112
|
-
"
|
|
1113
|
-
"title": {
|
|
1114
|
-
"type": "array",
|
|
1115
|
-
"items": {
|
|
1116
|
-
"type": "object",
|
|
1117
|
-
"properties": {
|
|
1118
|
-
"text": {
|
|
1119
|
-
"type": "object",
|
|
1120
|
-
"properties": {
|
|
1121
|
-
"content": {
|
|
1122
|
-
"type": "string"
|
|
1123
|
-
},
|
|
1124
|
-
"link": {
|
|
1125
|
-
"type": [
|
|
1126
|
-
"object",
|
|
1127
|
-
"null"
|
|
1128
|
-
],
|
|
1129
|
-
"properties": {
|
|
1130
|
-
"url": {
|
|
1131
|
-
"type": "string"
|
|
1132
|
-
}
|
|
1133
|
-
},
|
|
1134
|
-
"required": [
|
|
1135
|
-
"url"
|
|
1136
|
-
]
|
|
1137
|
-
}
|
|
1138
|
-
},
|
|
1139
|
-
"additionalProperties": false,
|
|
1140
|
-
"required": [
|
|
1141
|
-
"content"
|
|
1142
|
-
]
|
|
1143
|
-
},
|
|
1144
|
-
"type": {
|
|
1145
|
-
"enum": [
|
|
1146
|
-
"text"
|
|
1147
|
-
],
|
|
1148
|
-
"type": "string"
|
|
1149
|
-
}
|
|
1150
|
-
},
|
|
1151
|
-
"additionalProperties": false,
|
|
1152
|
-
"required": [
|
|
1153
|
-
"text"
|
|
1154
|
-
]
|
|
1155
|
-
},
|
|
1156
|
-
"maxItems": 100
|
|
1157
|
-
},
|
|
1158
|
-
"type": {
|
|
1159
|
-
"enum": [
|
|
1160
|
-
"title"
|
|
1161
|
-
],
|
|
1162
|
-
"type": "string"
|
|
1163
|
-
}
|
|
1164
|
-
},
|
|
1165
|
-
"additionalProperties": false,
|
|
1166
|
-
"required": [
|
|
1167
|
-
"title"
|
|
1168
|
-
]
|
|
1112
|
+
"additionalProperties": true
|
|
1169
1113
|
},
|
|
1170
1114
|
"in_trash": {
|
|
1171
1115
|
"type": "boolean",
|
|
@@ -1287,42 +1231,9 @@
|
|
|
1287
1231
|
"$ref": "#/components/schemas/parentRequest"
|
|
1288
1232
|
},
|
|
1289
1233
|
"properties": {
|
|
1234
|
+
"description": "The property values for the new page. The keys are the names or IDs of the property and the values are property values.",
|
|
1290
1235
|
"type": "object",
|
|
1291
|
-
"
|
|
1292
|
-
"title": {
|
|
1293
|
-
"type": "array",
|
|
1294
|
-
"items": {
|
|
1295
|
-
"type": "object",
|
|
1296
|
-
"required": [
|
|
1297
|
-
"text"
|
|
1298
|
-
],
|
|
1299
|
-
"properties": {
|
|
1300
|
-
"text": {
|
|
1301
|
-
"type": "object",
|
|
1302
|
-
"required": [
|
|
1303
|
-
"content"
|
|
1304
|
-
],
|
|
1305
|
-
"properties": {
|
|
1306
|
-
"content": {
|
|
1307
|
-
"type": "string"
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
},
|
|
1313
|
-
"maxItems": 100
|
|
1314
|
-
},
|
|
1315
|
-
"type": {
|
|
1316
|
-
"enum": [
|
|
1317
|
-
"title"
|
|
1318
|
-
],
|
|
1319
|
-
"type": "string"
|
|
1320
|
-
}
|
|
1321
|
-
},
|
|
1322
|
-
"additionalProperties": false,
|
|
1323
|
-
"required": [
|
|
1324
|
-
"title"
|
|
1325
|
-
]
|
|
1236
|
+
"additionalProperties": true
|
|
1326
1237
|
},
|
|
1327
1238
|
"children": {
|
|
1328
1239
|
"type": "array",
|
|
@@ -848,6 +848,100 @@ describe('OpenAPIToMCPConverter', () => {
|
|
|
848
848
|
description: 'A schema description',
|
|
849
849
|
})
|
|
850
850
|
})
|
|
851
|
+
|
|
852
|
+
it('preserves const values for oneOf discriminators', () => {
|
|
853
|
+
// Using 'as any' because OpenAPIV3 types don't include 'const' but the actual spec supports it
|
|
854
|
+
const spec = {
|
|
855
|
+
openapi: '3.0.0',
|
|
856
|
+
info: { title: 'Test API', version: '1.0.0' },
|
|
857
|
+
paths: {
|
|
858
|
+
'/resource': {
|
|
859
|
+
post: {
|
|
860
|
+
operationId: 'createResource',
|
|
861
|
+
summary: 'Create a resource with discriminated union',
|
|
862
|
+
requestBody: {
|
|
863
|
+
required: true,
|
|
864
|
+
content: {
|
|
865
|
+
'application/json': {
|
|
866
|
+
schema: {
|
|
867
|
+
type: 'object',
|
|
868
|
+
required: ['parent'],
|
|
869
|
+
properties: {
|
|
870
|
+
parent: {
|
|
871
|
+
$ref: '#/components/schemas/ParentRequest',
|
|
872
|
+
},
|
|
873
|
+
},
|
|
874
|
+
},
|
|
875
|
+
},
|
|
876
|
+
},
|
|
877
|
+
},
|
|
878
|
+
responses: {
|
|
879
|
+
'200': {
|
|
880
|
+
description: 'Success',
|
|
881
|
+
content: {
|
|
882
|
+
'application/json': {
|
|
883
|
+
schema: { type: 'object' },
|
|
884
|
+
},
|
|
885
|
+
},
|
|
886
|
+
},
|
|
887
|
+
},
|
|
888
|
+
},
|
|
889
|
+
},
|
|
890
|
+
},
|
|
891
|
+
components: {
|
|
892
|
+
schemas: {
|
|
893
|
+
PageIdParent: {
|
|
894
|
+
type: 'object',
|
|
895
|
+
properties: {
|
|
896
|
+
page_id: { type: 'string', format: 'uuid' },
|
|
897
|
+
},
|
|
898
|
+
required: ['page_id'],
|
|
899
|
+
},
|
|
900
|
+
DatabaseIdParent: {
|
|
901
|
+
type: 'object',
|
|
902
|
+
properties: {
|
|
903
|
+
type: { type: 'string', const: 'database_id' },
|
|
904
|
+
database_id: { type: 'string', format: 'uuid' },
|
|
905
|
+
},
|
|
906
|
+
required: ['database_id'],
|
|
907
|
+
},
|
|
908
|
+
ParentRequest: {
|
|
909
|
+
oneOf: [
|
|
910
|
+
{ $ref: '#/components/schemas/PageIdParent' },
|
|
911
|
+
{ $ref: '#/components/schemas/DatabaseIdParent' },
|
|
912
|
+
{
|
|
913
|
+
type: 'object',
|
|
914
|
+
properties: {
|
|
915
|
+
type: { const: 'workspace' },
|
|
916
|
+
},
|
|
917
|
+
required: ['type'],
|
|
918
|
+
},
|
|
919
|
+
],
|
|
920
|
+
},
|
|
921
|
+
},
|
|
922
|
+
},
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
const converter = new OpenAPIToMCPConverter(spec as unknown as OpenAPIV3.Document)
|
|
926
|
+
const { tools } = converter.convertToMCPTools()
|
|
927
|
+
|
|
928
|
+
const createResourceMethod = tools.API.methods.find((m) => m.name === 'createResource')
|
|
929
|
+
expect(createResourceMethod).toBeDefined()
|
|
930
|
+
|
|
931
|
+
// Verify const values are preserved in DatabaseIdParent
|
|
932
|
+
const databaseIdParent = createResourceMethod!.inputSchema.$defs?.DatabaseIdParent as any
|
|
933
|
+
expect(databaseIdParent).toBeDefined()
|
|
934
|
+
expect(databaseIdParent.properties.type.const).toBe('database_id')
|
|
935
|
+
|
|
936
|
+
// Verify const values are preserved in the inline workspace option
|
|
937
|
+
const parentRequest = createResourceMethod!.inputSchema.$defs?.ParentRequest as any
|
|
938
|
+
expect(parentRequest).toBeDefined()
|
|
939
|
+
expect(parentRequest.oneOf).toHaveLength(3)
|
|
940
|
+
|
|
941
|
+
// The third option is the workspace inline schema
|
|
942
|
+
const workspaceOption = parentRequest.oneOf[2]
|
|
943
|
+
expect(workspaceOption.properties.type.const).toBe('workspace')
|
|
944
|
+
})
|
|
851
945
|
})
|
|
852
946
|
|
|
853
947
|
// Additional complex test scenarios as a table test
|
|
@@ -118,6 +118,11 @@ export class OpenAPIToMCPConverter {
|
|
|
118
118
|
result.enum = schema.enum
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
// Handle const values (important for oneOf discriminators)
|
|
122
|
+
if ('const' in schema && schema.const !== undefined) {
|
|
123
|
+
result.const = schema.const as IJsonSchema['const']
|
|
124
|
+
}
|
|
125
|
+
|
|
121
126
|
if (schema.default !== undefined) {
|
|
122
127
|
result.default = schema.default
|
|
123
128
|
}
|