@tiangong-lca/mcp-server 0.0.21 → 0.0.22
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/src/_shared/init_server.js +2 -2
- package/dist/src/_shared/init_server_http_local.js +2 -2
- package/dist/src/prompts/lca_calculation.js +1 -1
- package/dist/src/resources/lca_calculation.js +1 -1
- package/dist/src/tools/lca_calculation_guidance.js +1 -1
- package/dist/src/tools/{openlca_ipc_process_list.js → openlca_ipc_system_processes_list.js} +9 -8
- package/dist/src/tools/tidas_data_validation.js +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import { regLcaCalculationGuidanceTool } from '../tools/lca_calculation_guidance
|
|
|
6
6
|
import { regLifecycleModelSearchTool } from '../tools/life_cycle_model_hybrid_search.js';
|
|
7
7
|
import { regOpenLcaLciaTool } from '../tools/openlca_ipc_lcia.js';
|
|
8
8
|
import { regOpenLcaListLCIAMethodsTool } from '../tools/openlca_ipc_lcia_methods_list.js';
|
|
9
|
-
import {
|
|
9
|
+
import { regOpenLcaListSystemProcessesTool } from '../tools/openlca_ipc_system_processes_list.js';
|
|
10
10
|
import { regProcessSearchTool } from '../tools/process_hybrid_search.js';
|
|
11
11
|
export function initializeServer(bearerKey) {
|
|
12
12
|
const server = new McpServer({
|
|
@@ -17,7 +17,7 @@ export function initializeServer(bearerKey) {
|
|
|
17
17
|
regProcessSearchTool(server, bearerKey);
|
|
18
18
|
regLifecycleModelSearchTool(server, bearerKey);
|
|
19
19
|
regOpenLcaLciaTool(server);
|
|
20
|
-
|
|
20
|
+
regOpenLcaListSystemProcessesTool(server);
|
|
21
21
|
regOpenLcaListLCIAMethodsTool(server);
|
|
22
22
|
regOpenLcaPrompts(server);
|
|
23
23
|
regOpenLcaResources(server);
|
|
@@ -3,7 +3,7 @@ import { regOpenLcaPrompts } from '../prompts/lca_calculation.js';
|
|
|
3
3
|
import { regOpenLcaResources } from '../resources/lca_calculation.js';
|
|
4
4
|
import { regOpenLcaLciaTool } from '../tools/openlca_ipc_lcia.js';
|
|
5
5
|
import { regOpenLcaListLCIAMethodsTool } from '../tools/openlca_ipc_lcia_methods_list.js';
|
|
6
|
-
import {
|
|
6
|
+
import { regOpenLcaListSystemProcessesTool } from '../tools/openlca_ipc_system_processes_list.js';
|
|
7
7
|
import { regTidasValidationTool } from '../tools/tidas_data_validation.js';
|
|
8
8
|
export function initializeServer() {
|
|
9
9
|
const server = new McpServer({
|
|
@@ -12,7 +12,7 @@ export function initializeServer() {
|
|
|
12
12
|
});
|
|
13
13
|
regOpenLcaLciaTool(server);
|
|
14
14
|
regOpenLcaListLCIAMethodsTool(server);
|
|
15
|
-
|
|
15
|
+
regOpenLcaListSystemProcessesTool(server);
|
|
16
16
|
regTidasValidationTool(server);
|
|
17
17
|
regOpenLcaPrompts(server);
|
|
18
18
|
regOpenLcaResources(server);
|
|
@@ -9,7 +9,7 @@ export function regOpenLcaPrompts(server) {
|
|
|
9
9
|
text: `I am an expert in Life Cycle Assessment (LCA) and use the MCP tool to perform LCA calculations.
|
|
10
10
|
The workflow is as follows:
|
|
11
11
|
1. Use the OpenLCA_Impact_Assessment_Tool to list all LCIA (Life Cycle Impact Assessment) method UUIDs and their corresponding names.
|
|
12
|
-
2. Use the
|
|
12
|
+
2. Use the OpenLCA_List_System_Processes_Tool to list all system process UUIDs and their corresponding names.
|
|
13
13
|
3. Use the OpenLCA_Impact_Assessment_Tool to perform LCA calculations.`,
|
|
14
14
|
},
|
|
15
15
|
},
|
|
@@ -7,7 +7,7 @@ export function regOpenLcaResources(server) {
|
|
|
7
7
|
mimeType: 'text/plain',
|
|
8
8
|
text: `The workflow to perform LCA calculations using the MCP tool is as follows:
|
|
9
9
|
1. Use the OpenLCA_Impact_Assessment_Tool to list all LCIA (Life Cycle Impact Assessment) method UUIDs and their corresponding names.
|
|
10
|
-
2. Use the
|
|
10
|
+
2. Use the OpenLCA_List_System_Processes_Tool to list all system process UUIDs and their corresponding names.
|
|
11
11
|
3. Use the OpenLCA_Impact_Assessment_Tool to perform LCA calculations.`,
|
|
12
12
|
},
|
|
13
13
|
],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
async function getLcaCalculationGuidance() {
|
|
2
2
|
const prompt = `The workflow to perform LCA calculations using the MCP tool is as follows:
|
|
3
3
|
1. Use the OpenLCA_Impact_Assessment_Tool to list all LCIA (Life Cycle Impact Assessment) method UUIDs and their corresponding names.
|
|
4
|
-
2. Use the
|
|
4
|
+
2. Use the OpenLCA_List_System_Processes_Tool to list all system process UUIDs and their corresponding names.
|
|
5
5
|
3. Use the OpenLCA_Impact_Assessment_Tool to perform LCA calculations.`;
|
|
6
6
|
return prompt;
|
|
7
7
|
}
|
|
@@ -3,13 +3,14 @@ import { z } from 'zod';
|
|
|
3
3
|
const input_schema = {
|
|
4
4
|
serverUrl: z.string().default('http://localhost:8080').describe('OpenLCA IPC server URL'),
|
|
5
5
|
};
|
|
6
|
-
async function
|
|
6
|
+
async function listSystemProcesses({ serverUrl = 'http://localhost:8080', }) {
|
|
7
7
|
const client = o.IpcClient.on(serverUrl);
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const processes = await client.getDescriptors(o.RefType.Process);
|
|
9
|
+
const systemProcesses = processes.filter((proc) => proc.processType === o.ProcessType.LCI_RESULT);
|
|
10
|
+
if (systemProcesses.length === 0) {
|
|
11
|
+
throw new Error('No system processes found');
|
|
11
12
|
}
|
|
12
|
-
const resultsObj =
|
|
13
|
+
const resultsObj = systemProcesses.map((sys) => {
|
|
13
14
|
const result = {
|
|
14
15
|
id: sys.id,
|
|
15
16
|
category: sys.category,
|
|
@@ -30,9 +31,9 @@ async function listProductSystems({ serverUrl = 'http://localhost:8080', }) {
|
|
|
30
31
|
});
|
|
31
32
|
return JSON.stringify(resultsObj);
|
|
32
33
|
}
|
|
33
|
-
export function
|
|
34
|
-
server.tool('
|
|
35
|
-
const result = await
|
|
34
|
+
export function regOpenLcaListSystemProcessesTool(server) {
|
|
35
|
+
server.tool('OpenLCA_List_System_Processes_Tool', 'List all system processes using OpenLCA.', input_schema, async ({ serverUrl }) => {
|
|
36
|
+
const result = await listSystemProcesses({
|
|
36
37
|
serverUrl: serverUrl,
|
|
37
38
|
});
|
|
38
39
|
return {
|
|
@@ -135,7 +135,7 @@ function validateTidasData(entityType, data) {
|
|
|
135
135
|
}
|
|
136
136
|
export function regTidasValidationTool(server) {
|
|
137
137
|
const entityTypeList = ENTITY_TYPES.map((type) => ` - ${type}: ${ENTITY_METADATA[type].name} - ${ENTITY_METADATA[type].description}`).join('\n');
|
|
138
|
-
server.tool('
|
|
138
|
+
server.tool('Tidas_Data_Validate_Tool', `Validate LCA data against Tidas SDK schemas.
|
|
139
139
|
|
|
140
140
|
Supported entity types (8 types):
|
|
141
141
|
${entityTypeList}
|