Skip to main content
Glama
linancn

TianGong-LCA-MCP Server

by linancn

Search_flows_Tool

Query and retrieve Life Cycle Assessment (LCA) flows data efficiently using a structured approach supported by the TianGong-LCA-MCP Server.

Instructions

Search LCA flows data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesQueries from user

Implementation Reference

  • Zod input schema for the Search_Flows_Tool, requiring a 'query' string.
    const input_schema = { query: z.string().min(1).describe('Queries from user'), };
  • Helper function that performs the hybrid search by POSTing the query to a Supabase edge function and returns JSON string of results.
    async function searchFlows({ query }: { query: string }, bearerKey?: string): Promise<string> { const url = `${supabase_base_url}/functions/v1/flow_hybrid_search`; // console.error('Headers:', headers); try { const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${bearerKey}`, 'x-region': x_region, }, body: JSON.stringify( cleanObject({ query, }), ), }); if (!response.ok) { throw new Error(`HTTP error: ${response.status} ${response.statusText}`); } const data = await response.json(); return JSON.stringify(data); } catch (error) { console.error('Error making the request:', error); throw error; } }
  • Inline handler function for Search_Flows_Tool that calls the searchFlows helper and formats the result as MCP text content.
    server.tool('Search_Flows_Tool', 'Search LCA flows data.', input_schema, async ({ query }) => { const result = await searchFlows( { query, }, bearerKey, ); return { content: [ { type: 'text', text: result, }, ], }; });
  • Registration function regFlowSearchTool that sets up the Search_Flows_Tool on the MCP server.
    export function regFlowSearchTool(server: McpServer, bearerKey?: string): void { server.tool('Search_Flows_Tool', 'Search LCA flows data.', input_schema, async ({ query }) => { const result = await searchFlows( { query, }, bearerKey, ); return { content: [ { type: 'text', text: result, }, ], }; }); }
  • Invocation of tool registration during MCP server initialization.
    regFlowSearchTool(server, bearerKey);

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