@icure/cardinal-mcp-server 1.1.0 → 1.1.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/dist/index.js +0 -0
- package/dist/tools/form-template-tools.d.ts +3 -0
- package/dist/tools/form-template-tools.d.ts.map +1 -0
- package/dist/tools/form-template-tools.js +13 -0
- package/dist/tools/form-template-tools.js.map +1 -0
- package/generated/docs-manifest.json +54 -62
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-template-tools.d.ts","sourceRoot":"","sources":["../../src/tools/form-template-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,QAa1D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dispatch } from "./dispatch.js";
|
|
3
|
+
const FORM_TEMPLATE_APIS = ["FormTemplate"];
|
|
4
|
+
export function registerFormTemplateTools(server) {
|
|
5
|
+
server.tool("cardinal_form_template", `Execute operations on FormTemplate entities. Covers: ${FORM_TEMPLATE_APIS.join(", ")} APIs. Supports CRUD, delete/undelete/purge, attachment upload, and filter-based matching. Use search_documentation to discover available methods and FormTemplateFilters for filter options.`, {
|
|
6
|
+
api: z.enum(FORM_TEMPLATE_APIS).describe("Which API to use"),
|
|
7
|
+
method: z.string().describe("Method name (e.g., getFormTemplate, createFormTemplate, matchFormTemplateBy)"),
|
|
8
|
+
params: z.record(z.unknown()).optional().default({}).describe("Method parameters as key-value pairs"),
|
|
9
|
+
}, async ({ api, method, params }) => {
|
|
10
|
+
return dispatch({ api, method, params });
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=form-template-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-template-tools.js","sourceRoot":"","sources":["../../src/tools/form-template-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,kBAAkB,GAAG,CAAC,cAAc,CAAU,CAAC;AAErD,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IAC1D,MAAM,CAAC,IAAI,CACV,wBAAwB,EACxB,wDAAwD,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,+LAA+L,EACpR;QACC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAC5D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8EAA8E,CAAC;QAC3G,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,sCAAsC,CAAC;KACrG,EACD,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE;QACjC,OAAO,QAAQ,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1C,CAAC,CACD,CAAC;AACH,CAAC"}
|
|
@@ -14566,18 +14566,18 @@
|
|
|
14566
14566
|
},
|
|
14567
14567
|
{
|
|
14568
14568
|
"name": "deleteTimeTableById",
|
|
14569
|
-
"description": "",
|
|
14569
|
+
"description": "Deletes a timeTable. If you don't have write access to the timeTable the method will fail.",
|
|
14570
14570
|
"params": [
|
|
14571
14571
|
{
|
|
14572
14572
|
"name": "entityId",
|
|
14573
14573
|
"type": "string",
|
|
14574
|
-
"description": "",
|
|
14574
|
+
"description": "id of the timeTable.",
|
|
14575
14575
|
"optional": false
|
|
14576
14576
|
},
|
|
14577
14577
|
{
|
|
14578
14578
|
"name": "rev",
|
|
14579
14579
|
"type": "string",
|
|
14580
|
-
"description": "",
|
|
14580
|
+
"description": "the latest known rev of the timeTable to delete",
|
|
14581
14581
|
"optional": false
|
|
14582
14582
|
}
|
|
14583
14583
|
],
|
|
@@ -14586,16 +14586,19 @@
|
|
|
14586
14586
|
"decrypted",
|
|
14587
14587
|
"encrypted",
|
|
14588
14588
|
"tryAndRecover"
|
|
14589
|
+
],
|
|
14590
|
+
"throws": [
|
|
14591
|
+
"RevisionConflictException if the provided revision doesn't match the latest known revision"
|
|
14589
14592
|
]
|
|
14590
14593
|
},
|
|
14591
14594
|
{
|
|
14592
14595
|
"name": "deleteTimeTablesByIds",
|
|
14593
|
-
"description": "",
|
|
14596
|
+
"description": "Deletes many timeTables. Ids that do not correspond to an entity, or that correspond to an entity for which you don't have write access will be ignored.",
|
|
14594
14597
|
"params": [
|
|
14595
14598
|
{
|
|
14596
14599
|
"name": "entityIds",
|
|
14597
14600
|
"type": "Array<StoredDocumentIdentifier>",
|
|
14598
|
-
"description": "",
|
|
14601
|
+
"description": "ids and revisions of the timeTables to delete.",
|
|
14599
14602
|
"optional": false
|
|
14600
14603
|
}
|
|
14601
14604
|
],
|
|
@@ -14608,18 +14611,18 @@
|
|
|
14608
14611
|
},
|
|
14609
14612
|
{
|
|
14610
14613
|
"name": "purgeTimeTableById",
|
|
14611
|
-
"description": "",
|
|
14614
|
+
"description": "Permanently deletes a timeTable.",
|
|
14612
14615
|
"params": [
|
|
14613
14616
|
{
|
|
14614
14617
|
"name": "id",
|
|
14615
14618
|
"type": "string",
|
|
14616
|
-
"description": "",
|
|
14619
|
+
"description": "id of the timeTable to purge",
|
|
14617
14620
|
"optional": false
|
|
14618
14621
|
},
|
|
14619
14622
|
{
|
|
14620
14623
|
"name": "rev",
|
|
14621
14624
|
"type": "string",
|
|
14622
|
-
"description": "",
|
|
14625
|
+
"description": "latest revision of the timeTable",
|
|
14623
14626
|
"optional": false
|
|
14624
14627
|
}
|
|
14625
14628
|
],
|
|
@@ -14628,16 +14631,19 @@
|
|
|
14628
14631
|
"decrypted",
|
|
14629
14632
|
"encrypted",
|
|
14630
14633
|
"tryAndRecover"
|
|
14634
|
+
],
|
|
14635
|
+
"throws": [
|
|
14636
|
+
"RevisionConflictException if the provided revision doesn't match the latest known revision"
|
|
14631
14637
|
]
|
|
14632
14638
|
},
|
|
14633
14639
|
{
|
|
14634
14640
|
"name": "deleteTimeTable",
|
|
14635
|
-
"description": "",
|
|
14641
|
+
"description": "Deletes a timeTable. If you don't have write access to the timeTable the method will fail.",
|
|
14636
14642
|
"params": [
|
|
14637
14643
|
{
|
|
14638
14644
|
"name": "timeTable",
|
|
14639
14645
|
"type": "TimeTable",
|
|
14640
|
-
"description": "",
|
|
14646
|
+
"description": "the timeTable to delete",
|
|
14641
14647
|
"optional": false
|
|
14642
14648
|
}
|
|
14643
14649
|
],
|
|
@@ -14646,16 +14652,19 @@
|
|
|
14646
14652
|
"decrypted",
|
|
14647
14653
|
"encrypted",
|
|
14648
14654
|
"tryAndRecover"
|
|
14655
|
+
],
|
|
14656
|
+
"throws": [
|
|
14657
|
+
"RevisionConflictException if the provided timeTable doesn't match the latest known revision"
|
|
14649
14658
|
]
|
|
14650
14659
|
},
|
|
14651
14660
|
{
|
|
14652
14661
|
"name": "deleteTimeTables",
|
|
14653
|
-
"description": "",
|
|
14662
|
+
"description": "Deletes many timeTables. Ignores timeTable for which you don't have write access or that don't match the latest revision.",
|
|
14654
14663
|
"params": [
|
|
14655
14664
|
{
|
|
14656
14665
|
"name": "timeTables",
|
|
14657
14666
|
"type": "Array<TimeTable>",
|
|
14658
|
-
"description": "",
|
|
14667
|
+
"description": "the timeTables to delete",
|
|
14659
14668
|
"optional": false
|
|
14660
14669
|
}
|
|
14661
14670
|
],
|
|
@@ -14668,12 +14677,12 @@
|
|
|
14668
14677
|
},
|
|
14669
14678
|
{
|
|
14670
14679
|
"name": "purgeTimeTable",
|
|
14671
|
-
"description": "",
|
|
14680
|
+
"description": "Permanently deletes a timeTable.",
|
|
14672
14681
|
"params": [
|
|
14673
14682
|
{
|
|
14674
14683
|
"name": "timeTable",
|
|
14675
14684
|
"type": "TimeTable",
|
|
14676
|
-
"description": "",
|
|
14685
|
+
"description": "the timeTable to purge.",
|
|
14677
14686
|
"optional": false
|
|
14678
14687
|
}
|
|
14679
14688
|
],
|
|
@@ -14682,16 +14691,19 @@
|
|
|
14682
14691
|
"decrypted",
|
|
14683
14692
|
"encrypted",
|
|
14684
14693
|
"tryAndRecover"
|
|
14694
|
+
],
|
|
14695
|
+
"throws": [
|
|
14696
|
+
"RevisionConflictException if the provided timeTable doesn't match the latest known revision"
|
|
14685
14697
|
]
|
|
14686
14698
|
},
|
|
14687
14699
|
{
|
|
14688
14700
|
"name": "undeleteTimeTable",
|
|
14689
|
-
"description": "",
|
|
14701
|
+
"description": "Restores a timeTable that was marked as deleted.",
|
|
14690
14702
|
"params": [
|
|
14691
14703
|
{
|
|
14692
14704
|
"name": "timeTable",
|
|
14693
14705
|
"type": "TimeTable",
|
|
14694
|
-
"description": "",
|
|
14706
|
+
"description": "the timeTable to undelete",
|
|
14695
14707
|
"optional": false
|
|
14696
14708
|
}
|
|
14697
14709
|
],
|
|
@@ -14700,16 +14712,19 @@
|
|
|
14700
14712
|
"decrypted",
|
|
14701
14713
|
"encrypted",
|
|
14702
14714
|
"tryAndRecover"
|
|
14715
|
+
],
|
|
14716
|
+
"throws": [
|
|
14717
|
+
"RevisionConflictException if the provided timeTable doesn't match the latest known revision"
|
|
14703
14718
|
]
|
|
14704
14719
|
},
|
|
14705
14720
|
{
|
|
14706
14721
|
"name": "modifyTimeTable",
|
|
14707
|
-
"description": "",
|
|
14722
|
+
"description": "Modifies a time-table. You need to have write access to the entity. Flavoured method.",
|
|
14708
14723
|
"params": [
|
|
14709
14724
|
{
|
|
14710
14725
|
"name": "entity",
|
|
14711
14726
|
"type": "TimeTable",
|
|
14712
|
-
"description": "",
|
|
14727
|
+
"description": "a time-table with update content",
|
|
14713
14728
|
"optional": false
|
|
14714
14729
|
}
|
|
14715
14730
|
],
|
|
@@ -14722,18 +14737,18 @@
|
|
|
14722
14737
|
},
|
|
14723
14738
|
{
|
|
14724
14739
|
"name": "undeleteTimeTableById",
|
|
14725
|
-
"description": "",
|
|
14740
|
+
"description": "Restores a timeTable that was marked as deleted.",
|
|
14726
14741
|
"params": [
|
|
14727
14742
|
{
|
|
14728
14743
|
"name": "id",
|
|
14729
14744
|
"type": "string",
|
|
14730
|
-
"description": "",
|
|
14745
|
+
"description": "the id of the entity",
|
|
14731
14746
|
"optional": false
|
|
14732
14747
|
},
|
|
14733
14748
|
{
|
|
14734
14749
|
"name": "rev",
|
|
14735
14750
|
"type": "string",
|
|
14736
|
-
"description": "",
|
|
14751
|
+
"description": "the latest revision of the entity.",
|
|
14737
14752
|
"optional": false
|
|
14738
14753
|
}
|
|
14739
14754
|
],
|
|
@@ -14742,16 +14757,19 @@
|
|
|
14742
14757
|
"decrypted",
|
|
14743
14758
|
"encrypted",
|
|
14744
14759
|
"tryAndRecover"
|
|
14760
|
+
],
|
|
14761
|
+
"throws": [
|
|
14762
|
+
"RevisionConflictException if the provided revision doesn't match the latest known revision"
|
|
14745
14763
|
]
|
|
14746
14764
|
},
|
|
14747
14765
|
{
|
|
14748
14766
|
"name": "getTimeTable",
|
|
14749
|
-
"description": "",
|
|
14767
|
+
"description": "Get a time-table by its id. You must have read access to the entity. Fails if the id does not correspond to any entity, corresponds to an entity that is not a time-table, or corresponds to an entity for which you don't have read access. Flavoured method.",
|
|
14750
14768
|
"params": [
|
|
14751
14769
|
{
|
|
14752
14770
|
"name": "entityId",
|
|
14753
14771
|
"type": "string",
|
|
14754
|
-
"description": "",
|
|
14772
|
+
"description": "a time-table id.",
|
|
14755
14773
|
"optional": false
|
|
14756
14774
|
}
|
|
14757
14775
|
],
|
|
@@ -14764,12 +14782,12 @@
|
|
|
14764
14782
|
},
|
|
14765
14783
|
{
|
|
14766
14784
|
"name": "getTimeTables",
|
|
14767
|
-
"description": "",
|
|
14785
|
+
"description": "Get multiple time tables by their ids. Ignores all ids that do not correspond to an entity, correspond to an entity that is not a time table, or correspond to an entity for which you don't have read access. Flavoured method.",
|
|
14768
14786
|
"params": [
|
|
14769
14787
|
{
|
|
14770
14788
|
"name": "timeTableIds",
|
|
14771
14789
|
"type": "Array<string>",
|
|
14772
|
-
"description": "",
|
|
14790
|
+
"description": "a list of time table ids",
|
|
14773
14791
|
"optional": false
|
|
14774
14792
|
}
|
|
14775
14793
|
],
|
|
@@ -14830,12 +14848,12 @@
|
|
|
14830
14848
|
},
|
|
14831
14849
|
{
|
|
14832
14850
|
"name": "filterTimeTablesBy",
|
|
14833
|
-
"description": "",
|
|
14851
|
+
"description": "Get an iterator that iterates through all timeTables matching the provided filter, executing multiple requests to the api if needed. This method does not guarantee that the returned data will be ordered when using sortable filter options. Even if the data obtained from an invocation of the method appears to be ordered, any changes to the stored data, or to the internal iCure implementations, may cause future invocations to return unordered data. If you need ordered data use [filterTimeTablesBySorted] instead.",
|
|
14834
14852
|
"params": [
|
|
14835
14853
|
{
|
|
14836
14854
|
"name": "filter",
|
|
14837
14855
|
"type": "BaseFilterOptions<TimeTable>",
|
|
14838
|
-
"description": "",
|
|
14856
|
+
"description": "a timeTable filter",
|
|
14839
14857
|
"optional": false
|
|
14840
14858
|
}
|
|
14841
14859
|
],
|
|
@@ -14848,12 +14866,12 @@
|
|
|
14848
14866
|
},
|
|
14849
14867
|
{
|
|
14850
14868
|
"name": "filterTimeTablesBySorted",
|
|
14851
|
-
"description": "",
|
|
14869
|
+
"description": "Get an iterator that iterates through all timeTables matching the provided filter, executing multiple requests to the api if needed. This method guarantees that the returned data will be ordered using the rules specified by the provided filter, but the operation may take longer than [filterTimeTablesBy].",
|
|
14852
14870
|
"params": [
|
|
14853
14871
|
{
|
|
14854
14872
|
"name": "filter",
|
|
14855
14873
|
"type": "BaseSortableFilterOptions<TimeTable>",
|
|
14856
|
-
"description": "",
|
|
14874
|
+
"description": "a timeTable filter",
|
|
14857
14875
|
"optional": false
|
|
14858
14876
|
}
|
|
14859
14877
|
],
|
|
@@ -14866,12 +14884,12 @@
|
|
|
14866
14884
|
},
|
|
14867
14885
|
{
|
|
14868
14886
|
"name": "createTimeTable",
|
|
14869
|
-
"description": "",
|
|
14887
|
+
"description": "Create a new time-table.",
|
|
14870
14888
|
"params": [
|
|
14871
14889
|
{
|
|
14872
14890
|
"name": "entity",
|
|
14873
14891
|
"type": "TimeTable",
|
|
14874
|
-
"description": "",
|
|
14892
|
+
"description": "a time-table.",
|
|
14875
14893
|
"optional": false
|
|
14876
14894
|
}
|
|
14877
14895
|
],
|
|
@@ -14884,12 +14902,12 @@
|
|
|
14884
14902
|
},
|
|
14885
14903
|
{
|
|
14886
14904
|
"name": "matchTimeTablesBy",
|
|
14887
|
-
"description": "",
|
|
14905
|
+
"description": "Get the ids of all timeTables matching the provided filter. This method does not guarantee that the returned data will be ordered when using sortable filter options. Even if the data obtained from an invocation of the method appears to be ordered, any changes to the stored data, or to the internal iCure implementations, may cause future invocations to return unordered data. If you need ordered data use [matchTimeTablesBySorted] instead.",
|
|
14888
14906
|
"params": [
|
|
14889
14907
|
{
|
|
14890
14908
|
"name": "filter",
|
|
14891
14909
|
"type": "BaseFilterOptions<TimeTable>",
|
|
14892
|
-
"description": "",
|
|
14910
|
+
"description": "a timeTable filter",
|
|
14893
14911
|
"optional": false
|
|
14894
14912
|
}
|
|
14895
14913
|
],
|
|
@@ -14902,12 +14920,12 @@
|
|
|
14902
14920
|
},
|
|
14903
14921
|
{
|
|
14904
14922
|
"name": "matchTimeTablesBySorted",
|
|
14905
|
-
"description": "",
|
|
14923
|
+
"description": "Get the ids of all timeTables matching the provided filter. This method guarantees that the returned data will be ordered using the rules specified by the provided filter, but the operation may take longer than [matchTimeTablesBy].",
|
|
14906
14924
|
"params": [
|
|
14907
14925
|
{
|
|
14908
14926
|
"name": "filter",
|
|
14909
14927
|
"type": "BaseSortableFilterOptions<TimeTable>",
|
|
14910
|
-
"description": "",
|
|
14928
|
+
"description": "a timeTable filter",
|
|
14911
14929
|
"optional": false
|
|
14912
14930
|
}
|
|
14913
14931
|
],
|
|
@@ -33216,31 +33234,5 @@
|
|
|
33216
33234
|
]
|
|
33217
33235
|
}
|
|
33218
33236
|
},
|
|
33219
|
-
"tutorials": [
|
|
33220
|
-
{
|
|
33221
|
-
"slug": "basic-tutorial-create-patient",
|
|
33222
|
-
"title": "Create a Patient",
|
|
33223
|
-
"content": "In the following example, the user reads a first name and last name from the standard input and instantiates a patient entity:\n\n```typescript\nconst firstName = await readLn(\"First name: \")\nconst lastName = await readLn(\"Last name: \")\nconst patient = new DecryptedPatient({\n\tid: uuid(),\n\tfirstName: firstName,\n\tlastName: lastName,\n})\n```\n\n```typescript\nconst patientWithMetadata = await sdk.patient.withEncryptionMetadata(patient)\n```\n\n```typescript\nconst createdPatient = await sdk.patient.createPatient(patientWithMetadata)\n```\n\nOnce created, the entity can be modified. In the following example, a date of birth is read from the standard input\nand added to the patient:\n\n```typescript\nconst dateOfBirth = parseInt((await readLn(\"Date of birth (YYYYMMDD): \")).trim())\nconst patientWithBirth = new DecryptedPatient({\n\t...createdPatient,\n\tdateOfBirth: dateOfBirth,\n})\nconst updatedPatient = await sdk.patient.modifyPatient(patientWithBirth)\n```\n\n```typescript\nconsole.log(\"The retrieved patient is:\")\nconst retrievedPatient = await sdk.patient.getPatient(updatedPatient.id)\n```"
|
|
33224
|
-
},
|
|
33225
|
-
{
|
|
33226
|
-
"slug": "basic-tutorial-create-medical-data",
|
|
33227
|
-
"title": "Create and Encrypt Medical Data",
|
|
33228
|
-
"content": "```typescript\nconst patientId = await readLn(\"Insert the id of a Patient (blank to create a new one): \")\nlet patient: DecryptedPatient\nif(patientId.length === 0) {\n\tpatient = await sdk.patient.createPatient(\n\t\tawait sdk.patient.withEncryptionMetadata(\n\t\t\tnew DecryptedPatient({\n\t\t\t\tid: uuid(),\n\t\t\t\tfirstName: \"Annabelle\",\n\t\t\t\tlastName: \"Hall\",\n\t\t\t})\n\t\t)\n\t)\n} else {\n\tpatient = await sdk.patient.getPatient(patientId)\n}\n```\n\n```typescript\nconst description = await readLn(\"Examination description: \")\nconst contact = new DecryptedContact({\n\tid: uuid(),\n\tdescr: description,\n\topeningDate: currentFuzzyDate()\n})\n```\n\n```typescript\nconst contactWithMetadata = await sdk.contact.withEncryptionMetadata(contact, patient)\n```\n\n```typescript\nconst createdContact = await sdk.contact.createContact(contactWithMetadata)\n```\n\n```typescript\nconst bloodPressureService = new DecryptedService({\n\tid: uuid(),\n\tlabel: \"Blood pressure\",\n\tidentifier: [new Identifier({system: \"cardinal\", value: \"bloodPressure\"})],\n\tcontent: {\n\t\t\"en\": new DecryptedContent({\n\t\t\tmeasureValue: new Measure({\n\t\t\t\tvalue: random(80, 120),\n\t\t\t\tunit: \"mmHg\"\n\t\t\t})\n\t\t})\n\t}\n})\n```\n\n```typescript\nconst contactWithBloodPressure = await sdk.contact.modifyContact(\n\tnew DecryptedContact({\n\t\t...createdContact,\n\t\tservices: [...createdContact.services, bloodPressureService]\n\t})\n)\n```\n\n```typescript\nconst ecgSignal = Array.from({ length: 10 }, () => random(0, 100)/100.0 )\nconst heartRateService = new DecryptedService({\n\tid: uuid(),\n\tidentifier: [new Identifier({system: \"cardinal\", value: \"ecg\"})],\n\tlabel: \"Heart rate\",\n\tcontent: {\n\t\t\"en\": new DecryptedContent({\n\t\t\ttimeSeries: new TimeSeries({\n\t\t\t\tsamples: [ecgSignal]\n\t\t\t})\n\t\t})\n\t}\n})\nconst contactWithECG = await sdk.contact.modifyContact(\n\tnew DecryptedContact({\n\t\t...contactWithBloodPressure,\n\t\tservices: [...contactWithBloodPressure.services, heartRateService]\n\t})\n)\n```\n\n```typescript\nconst document = new DecryptedDocument({\n\tid: uuid(),\n\tdocumentType: DocumentType.Labresult\n})\n```\n\n```typescript\nconst createdDocument = await sdk.document.createDocument(\n\tawait sdk.document.withEncryptionMetadata(document, null)\n)\n```\n\n```typescript\nconst xRayImage = new Int8Array(100)\nfor (let i = 0; i < 100; i++) {\n\txRayImage[i] = random(-127, 128)\n}\nconst documentWithAttachment = await sdk.document.encryptAndSetMainAttachment(\n\tcreatedDocument,\n\t[\"public.tiff\"],\n\txRayImage\n)\n```\n\n```typescript\nconst xRayService = new DecryptedService({\n\tid: uuid(),\n\tlabel: \"X-Ray image\",\n\tidentifier: [new Identifier({system: \"cardinal\", value: \"xRay\"})],\n\tcontent: {\n\t\t\"en\": new DecryptedContent({\n\t\t\tdocumentId: documentWithAttachment.id\n\t\t})\n\t}\n})\nconst contactWithImage = await sdk.contact.modifyContact(\n\tnew DecryptedContact({\n\t\t...contactWithECG,\n\t\tservices: [...contactWithECG.services, xRayService]\n\t})\n)\n```\n\n```typescript\nconst diagnosis = await readLn(\"What is the diagnosis?: \")\nconst healthElement = new DecryptedHealthElement({\n\tid: uuid(),\n\tdescr: diagnosis\n})\nconst createdDiagnosis = await sdk.healthElement.createHealthElement(\n\tawait sdk.healthElement.withEncryptionMetadata(healthElement, patient)\n)\n```\n\n```typescript\nconst contactWithDiagnosis = await sdk.contact.modifyContact(\n\tnew DecryptedContact({\n\t\t...contactWithImage,\n\t\tsubContacts: [\n\t\t\tnew DecryptedSubContact({\n\t\t\t\tdescr: \"Diagnosis\",\n\t\t\t\thealthElementId: createdDiagnosis.id\n\t\t\t})\n\t\t]\n\t})\n)\n```\n\n```typescript\nconst finalContact = await sdk.contact.modifyContact(\n\tnew DecryptedContact({\n\t\t...contactWithDiagnosis,\n\t\tclosingDate: currentFuzzyDate()\n\t})\n)\n```"
|
|
33229
|
-
},
|
|
33230
|
-
{
|
|
33231
|
-
"slug": "basic-tutorial-search-data",
|
|
33232
|
-
"title": "Search Data",
|
|
33233
|
-
"content": "```typescript\nconst nameToSearch = await readLn(\"Enter a name: \")\nconst patientIterator = await sdk.patient.filterPatientsBy(\n\tPatientFilters.byNameForSelf(nameToSearch)\n)\n```\n\n```typescript\nlet patient: Patient | null = null\nwhile ((await patientIterator.hasNext()) && patient == null) {\n\tconst p = (await patientIterator.next(1))[0]\n\tprettyPrintPatient(p)\n\tconst use = (await readLn(\"Use this patient? [y/N]: \")).trim().toLowerCase() === \"y\"\n\tif (use) {\n\t\tpatient = p\n\t}\n}\n\nif (patient == null) {\n\tconsole.log(\"No matching patient found\")\n\treturn\n}\n```\n\n```typescript\nconst contactIterator = await sdk.contact.filterContactsBy(\n\tContactFilters.byPatientsForSelf([patient])\n)\n\nif (!(await contactIterator.hasNext())) {\n\tconsole.log(\"No matching contacts found\")\n}\n\nwhile(await contactIterator.hasNext()) {\n\tconst contact = (await contactIterator.next(1))[0]\n\tprettyPrintContact(contact)\n\tawait readLn(\"Press enter for next contact\")\n}\n```\n\n```typescript\nlet choice = -1\nwhile (choice < 0 || choice >= 3) {\n\tconsole.log(\"0. blood pressure\")\n\tconsole.log(\"1. heart rate\")\n\tconsole.log(\"2. x ray\")\n\tchoice = parseInt((await readLn(\"Enter your choice: \")).trim())\n}\n\nlet identifier: Identifier\nswitch (choice) {\n\tcase 0:\n\t\tidentifier = new Identifier({system: \"cardinal\", value: \"bloodPressure\"})\n\t\tbreak\n\tcase 1:\n\t\tidentifier = new Identifier({system: \"cardinal\", value: \"ecg\"})\n\t\tbreak\n\tdefault:\n\t\tidentifier = new Identifier({system: \"cardinal\", value: \"xRay\"})\n\t\tbreak\n}\n\nconst serviceIterator = await sdk.contact.filterServicesBy(\n\tServiceFilters.byIdentifiersForSelf([identifier])\n)\n\nif (!(await serviceIterator.hasNext())) {\n\tconsole.log(\"No matching services found\")\n}\n\nwhile (await serviceIterator.hasNext()) {\n\tconst service = (await serviceIterator.next(1))[0]\n\tprettyPrintService(service)\n\tawait readLn(\"Press enter for next service\")\n}\n```"
|
|
33234
|
-
},
|
|
33235
|
-
{
|
|
33236
|
-
"slug": "basic-tutorial-share-data",
|
|
33237
|
-
"title": "Share Encrypted Data",
|
|
33238
|
-
"content": "```typescript\nconst username = (await readLn(\"Login of the other hcp: \")).trim()\nconst otherPassword = await readLn(\"Insert the password for this hcp: \")\nconst otherSdk = await CardinalSdk.initialize(\n\tundefined,\n\tCARDINAL_URL,\n\tnew AuthenticationMethod.UsingCredentials.UsernamePassword(username, otherPassword),\n\tStorageFacade.usingFileSystem(\"../scratch/storage\")\n)\nconst otherHcp = await otherSdk.healthcareParty.getCurrentHealthcareParty()\n```\n\n```typescript\nconst oldDocument = await sdk.document.createDocument(\n\tawait sdk.document.withEncryptionMetadata(new DecryptedDocument({\n\t\t\tid: uuid(),\n\t\t\tname: \"An important document\"\n\t\t}),\n\t\tnull\n\t)\n)\n```\n\n```typescript\ntry {\n\tawait otherSdk.document.getDocument(oldDocument.id)\n} catch (e) {\n\tconsole.error(\"This means I am not authorized to read the document -> \", e)\n}\n```\n\n```typescript\nupdatedDocument = await sdk.document.shareWith(\n\totherHcp.id,\n\toldDocument\n)\n```\n\n```typescript\nconst oldDocumentOtherHcp = await otherSdk.document.getDocument(oldDocument.id)\n```\n\n```typescript\nconst newDocument = new DecryptedDocument({\n\tid: uuid(),\n\tname: \"Another important document\"\n})\nconst newDocumentWithMetadata = await sdk.document.withEncryptionMetadata(\n\tnewDocument,\n\tnull,\n\t{ delegates: { [otherHcp.id]: AccessLevel.Read } }\n)\nconst createdNewDocument = await sdk.document.createDocument(newDocumentWithMetadata)\n```\n\n```typescript\nconst newDocumentOtherHcp = await otherSdk.document.getDocument(createdNewDocument.id)\n```\n\n```typescript\nconst newPatient = new DecryptedPatient({\n\tid: uuid(),\n\tfirstName: \"Edmond\",\n\tlastName: \"Dantes\",\n})\nconst patientWithMetadata = await sdk.patient.withEncryptionMetadata(newPatient)\nconst createdPatient = await sdk.patient.createPatient(patientWithMetadata)\n```\n\n```typescript\nconst login = `edmond.dantes.${uuid().substring(0, 6)}@icure.com`\nconst patientUser = new User({\n\tid: uuid(),\n\tpatientId: createdPatient.id,\n\tlogin: login,\n\temail: login\n})\nconst createdUser = await sdk.user.createUser(patientUser)\n```\n\n```typescript\nconst loginToken = await sdk.user.getToken(createdUser.id, \"login\")\n```\n\n```typescript\nawait CardinalSdk.initialize(\n\tundefined,\n\tCARDINAL_URL,\n\tnew AuthenticationMethod.UsingCredentials.UsernamePassword(login, loginToken),\n\tStorageFacade.usingFileSystem(\"../scratch/storage\")\n)\n```\n\n```typescript\nconst patient = await sdk.patient.shareWith(\n\tcreatedPatient.id,\n\tcreatedPatient,\n\t{\n\t\toptions: new PatientShareOptions({\n\t\t\tshareSecretIds: new SecretIdShareOptions.AllAvailable({requireAtLeastOne: true}),\n\t\t\tshareEncryptionKey: ShareMetadataBehaviour.IfAvailable,\n\t\t\trequestedPermissions: RequestedPermission.MaxWrite\n\t\t})\n\t}\n)\n```\n\n```typescript\nconst patientSdk = await CardinalSdk.initialize(\n\tundefined,\n\tCARDINAL_URL,\n\tnew AuthenticationMethod.UsingCredentials.UsernamePassword(login, loginToken),\n\tStorageFacade.usingFileSystem(\"../scratch/storage\")\n)\n```\n\n```typescript\nconst healthElement = new DecryptedHealthElement({\n\tid: uuid(),\n\tdescr: \"This is some medical context\"\n})\nconst healthElementWithMetadata = await sdk.healthElement.withEncryptionMetadata(healthElement, patient)\nconst createdHealthElement = await sdk.healthElement.createHealthElement(healthElementWithMetadata)\n```\n\n```typescript\ntry {\n\tawait patientSdk.healthElement.getHealthElement(createdHealthElement.id)\n} catch (e) {\n\tconsole.error(\"This means the patient cannot get this health element\", e)\n}\n```\n\n```typescript\nconst healthElement = await sdk.healthElement.shareWith(\n\tpatient.id,\n\tcreatedHealthElement\n)\n```\n\n```typescript\nawait patientSdk.healthElement.getHealthElement(createdHealthElement.id)\n```\n\n```typescript\nconst newHealthElement = new DecryptedHealthElement({\n\tid: uuid(),\n\tdescr: \"This is some other medical context\"\n})\nconst newHealthElementWithMetadata = await sdk.healthElement.withEncryptionMetadata(\n\tnewHealthElement,\n\tpatient,\n\t{ delegates: { [patient.id]: AccessLevel.Write } }\n)\nconst newCreatedHealthElement = await sdk.healthElement.createHealthElement(newHealthElementWithMetadata)\n```\n\n```typescript\nconst retrievedHealthElement = await patientSdk.healthElement.getHealthElement(newCreatedHealthElement.id)\n```"
|
|
33239
|
-
},
|
|
33240
|
-
{
|
|
33241
|
-
"slug": "basic-tutorial-codifications",
|
|
33242
|
-
"title": "Use Codification Systems",
|
|
33243
|
-
"content": "```typescript\nconst internalCode = await sdk.code.createCode(new Code({\n\tid: \"INTERNAL|ANALYSIS|1\",\n\ttype: \"INTERNAL\",\n\tcode: \"ANALYSIS\",\n\tversion: \"1\",\n\tlabel: {\"en\": \"Internal analysis code\"}\n}))\nawait sdk.code.createCodes([\n\tnew Code({\n\t\tid: \"SNOMED|45007003|1\",\n\t\ttype: \"SNOMED\",\n\t\tcode: \"45007003\",\n\t\tversion: \"1\",\n\t\tlabel: {\"en\": \"Low blood pressure\"}\n\t}),\n\tnew Code({\n\t\tid: \"SNOMED|38341003|1\",\n\t\ttype: \"SNOMED\",\n\t\tcode: \"38341003\",\n\t\tversion: \"1\",\n\t\tlabel: {\"en\": \"High blood pressure\"}\n\t}),\n\tnew Code({\n\t\tid: \"SNOMED|2004005|1\",\n\t\ttype: \"SNOMED\",\n\t\tcode: \"2004005\",\n\t\tversion: \"1\",\n\t\tlabel: {\"en\": \"Normal blood pressure\"}\n\t})\n])\n```\n\n```typescript\nconst codeIterator = await sdk.code.filterCodesBy(\n\tCodeFilters.byLanguageTypeLabelRegion(\n\t\t\"en\",\n\t\t\"SNOMED\",\n\t\t{ label: \"blood\" }\n\t)\n)\n\nlet selectedCode: Code | null = null\nwhile ((await codeIterator.hasNext()) && selectedCode == null) {\n\tconst code = (await codeIterator.next(1))[0]\n\tprettyPrintCode(code)\n\tconst use = (await readLn(\"Use this code? [y/N]: \")).trim().toLowerCase() === \"y\"\n\tif (use) {\n\t\tselectedCode = code\n\t}\n}\n\nif (selectedCode == null) {\n\tconsole.log(\"No code was selected\")\n\treturn\n}\n\nconst patient = await sdk.patient.createPatient(\n\tawait sdk.patient.withEncryptionMetadata(\n\t\tnew DecryptedPatient({\n\t\t\tid: uuid(),\n\t\t\tfirstName: \"Annabelle\",\n\t\t\tlastName: \"Hall\",\n\t\t})\n\t)\n)\n\nconst contact = new DecryptedContact({\n\tid: uuid(),\n\tdescr: \"Blood pressure measurement\",\n\topeningDate: currentFuzzyDate(),\n\tservices: [\n\t\tnew DecryptedService({\n\t\t\tid: uuid(),\n\t\t\tlabel: \"Blood pressure\",\n\t\t\tcontent: {\n\t\t\t\t\"en\": new DecryptedContent({\n\t\t\t\t\tmeasureValue: new Measure({\n\t\t\t\t\t\tvalue: random(80, 120),\n\t\t\t\t\t\tunit: \"mmHg\"\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t],\n\ttags: [\n\t\tnew CodeStub({\n\t\t\tid: selectedCode.id,\n\t\t\ttype: selectedCode.type,\n\t\t\tcode: selectedCode.code,\n\t\t\tversion: selectedCode.version\n\t\t})\n\t]\n})\nconst createdContact = await sdk.contact.createContact(\n\tawait sdk.contact.withEncryptionMetadata(contact, patient)\n)\n```\n\n```typescript\nconst serviceIterator = await sdk.contact.filterServicesBy(\n\tServiceFilters.byTagAndValueDateForSelf(\n\t\tselectedCode.type,\n\t\t{ tagCode: selectedCode.code }\n\t)\n)\n\nconsole.log(`Result of searching Services by code: ${selectedCode.id}`)\nwhile (await serviceIterator.hasNext()) {\n\tconst service = (await serviceIterator.next(1))[0]\n\tprettyPrintService(service)\n}\n```"
|
|
33244
|
-
}
|
|
33245
|
-
]
|
|
33237
|
+
"tutorials": []
|
|
33246
33238
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icure/cardinal-mcp-server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "MCP server exposing Cardinal SDK documentation and operational tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "tsc",
|
|
16
16
|
"generate": "tsx scripts/extract-docs.ts && tsx scripts/generate-registry.ts",
|
|
17
|
-
"prepublishOnly": "
|
|
17
|
+
"prepublishOnly": "yarn generate && yarn build",
|
|
18
18
|
"publish:npm": "npm publish --access public",
|
|
19
19
|
"start": "node dist/index.js",
|
|
20
20
|
"dev": "tsx src/index.ts"
|
|
@@ -41,5 +41,6 @@
|
|
|
41
41
|
"@types/node": "^22.0.0",
|
|
42
42
|
"tsx": "^4.0.0",
|
|
43
43
|
"typescript": "^5.7.0"
|
|
44
|
-
}
|
|
44
|
+
},
|
|
45
|
+
"packageManager": "yarn@4.12.0+sha512.f45ab632439a67f8bc759bf32ead036a1f413287b9042726b7cc4818b7b49e14e9423ba49b18f9e06ea4941c1ad062385b1d8760a8d5091a1a31e5f6219afca8"
|
|
45
46
|
}
|