@icure/cardinal-mcp-server 1.0.1 → 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 CHANGED
File without changes
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { dispatch } from "./dispatch.js";
3
- const ADMIN_APIS = ["Group", "User", "Role", "Permission", "System", "Auth", "ApplicationSettings"];
3
+ const ADMIN_APIS = ["Group", "User", "Role", "Permission", "System", "Auth"];
4
4
  export function registerAdminTools(server) {
5
5
  server.tool("cardinal_admin", `Execute admin operations. Covers: ${ADMIN_APIS.join(", ")} APIs. Use search_documentation to discover available methods.`, {
6
6
  api: z.enum(ADMIN_APIS).describe("Which admin API to use"),
@@ -1 +1 @@
1
- {"version":3,"file":"admin-tools.js","sourceRoot":"","sources":["../../src/tools/admin-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,qBAAqB,CAAU,CAAC;AAE7G,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IACnD,MAAM,CAAC,IAAI,CACV,gBAAgB,EAChB,qCAAqC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,gEAAgE,EAC1H;QACC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC1D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;QACnF,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"}
1
+ {"version":3,"file":"admin-tools.js","sourceRoot":"","sources":["../../src/tools/admin-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAEtF,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IACnD,MAAM,CAAC,IAAI,CACV,gBAAgB,EAChB,qCAAqC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,gEAAgE,EAC1H;QACC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC1D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;QACnF,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"data-owner-tools.d.ts","sourceRoot":"","sources":["../../src/tools/data-owner-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAiBpE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,QAcvD"}
1
+ {"version":3,"file":"data-owner-tools.d.ts","sourceRoot":"","sources":["../../src/tools/data-owner-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAUpE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,QAcvD"}
@@ -1,14 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { dispatch } from "./dispatch.js";
3
3
  const DATA_OWNER_APIS = [
4
- "HealthcareParty", "Patient", "Device",
5
- "AccessLog", "CalendarItem", "Classification", "Contact", "Document",
6
- "Form", "HealthElement", "Invoice", "MaintenanceTask", "Message",
7
- "Receipt", "TimeTable", "Topic",
8
- "Agenda", "CalendarItemType", "Code", "DocumentTemplate",
9
- "EntityReference", "EntityTemplate", "FrontEndMigration",
10
- "Insurance", "Keyword", "MedicalLocation", "Place", "Tarification",
11
- "FormTemplate",
4
+ "HealthcareParty", "Patient", "Device"
12
5
  ];
13
6
  const FLAVOUR_VALUES = ["decrypted", "encrypted", "tryAndRecover"];
14
7
  export function registerDataOwnerTools(server) {
@@ -1 +1 @@
1
- {"version":3,"file":"data-owner-tools.js","sourceRoot":"","sources":["../../src/tools/data-owner-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,eAAe,GAAG;IACvB,iBAAiB,EAAE,SAAS,EAAE,QAAQ;IACtC,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU;IACpE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS;IAChE,SAAS,EAAE,WAAW,EAAE,OAAO;IAC/B,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB;IACxD,iBAAiB,EAAE,gBAAgB,EAAE,mBAAmB;IACxD,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,OAAO,EAAE,cAAc;IAClE,cAAc;CACL,CAAC;AAEX,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,CAAU,CAAC;AAE5E,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACvD,MAAM,CAAC,IAAI,CACV,qBAAqB,EACrB,2DAA2D,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,qKAAqK,EAC1P;QACC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QACzD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sEAAsE,CAAC;QACnG,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4EAA4E,CAAC;QACjI,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,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAC1C,OAAO,QAAQ,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACnD,CAAC,CACD,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"data-owner-tools.js","sourceRoot":"","sources":["../../src/tools/data-owner-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,eAAe,GAAG;IACvB,iBAAiB,EAAE,SAAS,EAAE,QAAQ;CAC7B,CAAC;AAEX,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,CAAU,CAAC;AAE5E,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACvD,MAAM,CAAC,IAAI,CACV,qBAAqB,EACrB,2DAA2D,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,qKAAqK,EAC1P;QACC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QACzD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sEAAsE,CAAC;QACnG,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4EAA4E,CAAC;QACjI,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,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAC1C,OAAO,QAAQ,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACnD,CAAC,CACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerFormTemplateTools(server: McpServer): void;
3
+ //# sourceMappingURL=form-template-tools.d.ts.map
@@ -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"}
@@ -33234,31 +33234,5 @@
33234
33234
  ]
33235
33235
  }
33236
33236
  },
33237
- "tutorials": [
33238
- {
33239
- "slug": "basic-tutorial-create-patient",
33240
- "title": "Create a Patient",
33241
- "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```"
33242
- },
33243
- {
33244
- "slug": "basic-tutorial-create-medical-data",
33245
- "title": "Create and Encrypt Medical Data",
33246
- "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```"
33247
- },
33248
- {
33249
- "slug": "basic-tutorial-search-data",
33250
- "title": "Search Data",
33251
- "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```"
33252
- },
33253
- {
33254
- "slug": "basic-tutorial-share-data",
33255
- "title": "Share Encrypted Data",
33256
- "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```"
33257
- },
33258
- {
33259
- "slug": "basic-tutorial-codifications",
33260
- "title": "Use Codification Systems",
33261
- "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```"
33262
- }
33263
- ]
33237
+ "tutorials": []
33264
33238
  }
@@ -8403,7 +8403,7 @@ export const METHOD_REGISTRY: Record<string, ApiInfo> = {
8403
8403
  "TimeTable": {
8404
8404
  "apiName": "TimeTableApi",
8405
8405
  "propertyName": "timeTable",
8406
- "isEncryptable": true,
8406
+ "isEncryptable": false,
8407
8407
  "methods": [
8408
8408
  {
8409
8409
  "name": "deleteTimeTableUnsafe",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icure/cardinal-mcp-server",
3
- "version": "1.0.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": "npm run generate && npm run build",
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
  }