Skip to main content
Glama
blake365

Macrostrat MCP Server

by blake365

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
NameRequiredDescriptionDefault
mineralNoThe name of the mineral
mineral_typeNoThe type of mineral
elementNoAn element that the mineral is made of

Implementation Reference

  • 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)
        }]
      };
    }
  • 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)
          }]
        };
      }
    );

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/blake365/macrostrat-mcp'

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