Skip to main content
Glama
blake365

Macrostrat MCP Server

by blake365

mineral-info

Query detailed mineral data by name, type, or elemental composition using the Macrostrat API. Access comprehensive geologic information for analysis or research purposes.

Instructions

Get information about a mineral, use one property

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementNoAn element that the mineral is made of
mineralNoThe name of the mineral
mineral_typeNoThe type of mineral

Implementation Reference

  • The asynchronous handler function for the 'mineral-info' tool. It destructures input parameters, constructs query parameters, fetches data from the Macrostrat API endpoint '/defs/minerals', parses the JSON response, and returns it formatted as text content.
    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) }] }; }
  • The schema object passed to registerTool, defining the tool's title, description, and inputSchema using Zod validators for optional string parameters: mineral, mineral_type, and element.
    { 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"), } },
  • src/index.ts:1025-1052 (registration)
    The server.registerTool call that registers the 'mineral-info' tool, specifying the name, schema, and 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) }] }; } );

Other Tools

Related Tools

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