Search_Processes_Tool
Search Life Cycle Assessment (LCA) processes data to find relevant environmental impact information for sustainability analysis.
Instructions
Search LCA processes data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Queries from user |
Implementation Reference
- src/tools/process_hybrid_search.ts:10-36 (handler)Core handler function that executes the hybrid search by calling a Supabase edge function with the query.async function searchProcesses({ query }: { query: string }, bearerKey?: string): Promise<string> { const url = `${supabase_base_url}/functions/v1/process_hybrid_search`; // console.error('URL:', url); 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; } }
- Input schema using Zod for validating the tool's 'query' parameter.const input_schema = { query: z.string().min(1).describe('Queries from user'), };
- src/tools/process_hybrid_search.ts:38-60 (registration)Registers the 'Search_Processes_Tool' with the MCP server, linking schema and handler.export function regProcessSearchTool(server: McpServer, bearerKey?: string): void { server.tool( 'Search_Processes_Tool', 'Search LCA processes data.', input_schema, async ({ query }) => { const result = await searchProcesses( { query, }, bearerKey, ); return { content: [ { type: 'text', text: result, }, ], }; }, ); }