Skip to main content
Glama
linancn

TianGong-LCA-MCP Server

by linancn

OpenLCA_List_LCIA_Methods_Tool

Retrieve a comprehensive list of LCIA methods from OpenLCA. Ideal for TianGong-LCA-MCP Server users to access environmental impact assessment data efficiently.

Instructions

List all LCIA methods using OpenLCA.

Input Schema

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

Implementation Reference

  • Core handler logic that connects to the OpenLCA IPC server, fetches LCIA method descriptors, processes them into a clean object array, and returns a 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, defining the optional serverUrl.
    const input_schema = { serverUrl: z.string().default('http://localhost:8080').describe('OpenLCA IPC server URL'), };
  • Registration function that registers the tool on the MCP server using server.tool, specifying name, description, input schema, and execution 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, }, ], }; }, ); }
  • Invocation of the tool registration during general server initialization.
    regOpenLcaListLCIAMethodsTool(server);
  • Invocation of the tool registration during HTTP local 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