OpenLCA_List_System_Processes_Tool
Lists all system processes in OpenLCA for inventory analysis and modeling workflows. Connect to an OpenLCA IPC server to retrieve process data.
Instructions
List all system processes using OpenLCA.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serverUrl | No | OpenLCA IPC server URL | http://localhost:8080 |
Implementation Reference
- Core function that executes the tool logic: connects to OpenLCA IPC server, retrieves process descriptors, filters for system processes (LCI_RESULT type), formats the data by removing undefined fields, and returns JSON string.async function listSystemProcesses({ serverUrl = 'http://localhost:8080', }: { serverUrl?: string; }): Promise<string> { const client = o.IpcClient.on(serverUrl); const processes = await client.getDescriptors(o.RefType.Process); const systemProcesses = processes.filter((proc) => proc.processType === o.ProcessType.LCI_RESULT); if (systemProcesses.length === 0) { throw new Error('No system processes found'); } const resultsObj = systemProcesses.map((sys) => { // Create full object const result: Record<string, any> = { id: sys.id, category: sys.category, description: sys.description, flowType: sys.flowType, location: sys.location, name: sys.name, processType: sys.processType, refUnit: sys.refUnit, refType: sys.refType, }; // Remove undefined properties Object.keys(result).forEach((key) => { if (result[key] === undefined) { delete result[key]; } }); return result; }); return JSON.stringify(resultsObj); }
- Zod schema defining the tool's input parameters, specifically the optional OpenLCA server URL.const input_schema = { serverUrl: z.string().default('http://localhost:8080').describe('OpenLCA IPC server URL'), };
- src/tools/openlca_ipc_system_processes_list.ts:49-69 (registration)Registration function that adds the tool to the MCP server using server.tool(), including name, description, input schema, and handler function.export function regOpenLcaListSystemProcessesTool(server: McpServer) { server.tool( 'OpenLCA_List_System_Processes_Tool', 'List all system processes using OpenLCA.', input_schema, async ({ serverUrl }) => { const result = await listSystemProcesses({ serverUrl: serverUrl, }); return { content: [ { type: 'text', text: result, }, ], }; }, ); }
- src/_shared/init_server.ts:25-25 (registration)Invokes the tool registration during MCP server initialization.regOpenLcaListSystemProcessesTool(server);