Skip to main content
Glama
linancn

TianGong-LCA-MCP Server

by linancn

OpenLCA_List_LCIA_Methods_Tool

Retrieve available life cycle impact assessment methods from an OpenLCA server to support environmental impact analysis in LCA studies.

Instructions

List all LCIA methods using OpenLCA.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverUrlNoOpenLCA IPC server URLhttp://localhost:8080

Implementation Reference

  • Main handler logic: Connects to OpenLCA IPC server, retrieves LCIA method descriptors, formats them into objects (removing undefined fields), and returns JSON string.
    async function listLCIAMethods({ serverUrl = 'http://localhost:8080', }: { serverUrl?: string; }): Promise<string> { const client = o.IpcClient.on(serverUrl); const impactMethods = await client.getDescriptors(o.RefType.ImpactMethod); if (impactMethods.length === 0) { throw new Error('No LICA methods found'); } console.log(impactMethods); const resultsObj = impactMethods.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 for tool input parameters, specifically the OpenLCA server URL.
    const input_schema = { serverUrl: z.string().default('http://localhost:8080').describe('OpenLCA IPC server URL'), };
  • Exports the registration function that calls server.tool() to register 'OpenLCA_List_LCIA_Methods_Tool' with its description, input schema, and thin wrapper handler.
    export function regOpenLcaListLCIAMethodsTool(server: McpServer) { server.tool( 'OpenLCA_List_LCIA_Methods_Tool', 'List all LCIA methods using OpenLCA.', input_schema, async ({ serverUrl }) => { const result = await listLCIAMethods({ serverUrl: serverUrl, }); return { content: [ { type: 'text', text: result, }, ], }; }, ); }
  • Calls the tool registration function during MCP server initialization.
    regOpenLcaListLCIAMethodsTool(server);
  • Calls the tool registration function in local HTTP server initialization.
    regOpenLcaListLCIAMethodsTool(server);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/linancn/tiangong-lca-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server