mineral-info
Retrieve detailed information about minerals by specifying a mineral name, type, or constituent element. Access comprehensive geological data from the Macrostrat database to identify mineral properties and characteristics.
Instructions
Get information about a mineral, use one property
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mineral | No | The name of the mineral | |
| mineral_type | No | The type of mineral | |
| element | No | An element that the mineral is made of |
Implementation Reference
- src/index.ts:1036-1051 (handler)The handler function for the 'mineral-info' tool. It takes input parameters (mineral, mineral_type, or element), constructs a query to the Macrostrat API /defs/minerals endpoint, fetches the data, and returns it as a formatted JSON text response.async (request) => { const { mineral, mineral_type, element } = request; const params = new URLSearchParams(); if (mineral) params.append("mineral", mineral); if (mineral_type) params.append("mineral_type", mineral_type); if (element) params.append("element", element); const response = await fetch(`${getApiEndpoint("base")}/defs/minerals?${params}`); const data = await response.json(); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }
- src/index.ts:1030-1034 (schema)Input schema definition using Zod for validating tool parameters: mineral name, type, or composing element.inputSchema: { mineral: z.string().optional().describe("The name of the mineral"), mineral_type: z.string().optional().describe("The type of mineral"), element: z.string().optional().describe("An element that the mineral is made of"), }
- src/index.ts:1025-1052 (registration)Registration of the 'mineral-info' tool with server.registerTool, including name, metadata/schema, and inline handler function.server.registerTool( "mineral-info", { title: "Mineral Information", description: "Get information about a mineral, use one property", inputSchema: { mineral: z.string().optional().describe("The name of the mineral"), mineral_type: z.string().optional().describe("The type of mineral"), element: z.string().optional().describe("An element that the mineral is made of"), } }, async (request) => { const { mineral, mineral_type, element } = request; const params = new URLSearchParams(); if (mineral) params.append("mineral", mineral); if (mineral_type) params.append("mineral_type", mineral_type); if (element) params.append("element", element); const response = await fetch(`${getApiEndpoint("base")}/defs/minerals?${params}`); const data = await response.json(); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } );