Skip to main content
Glama
blake365

Macrostrat MCP Server

by blake365

Definitions Autocomplete

defs-autocomplete

Retrieve geological definitions by entering search terms to access comprehensive geologic data from the Macrostrat API.

Instructions

Quickly retrieve all definitions matching a query. Limited to 100 results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesthe search term

Implementation Reference

  • src/index.ts:1001-1024 (registration)
    Registration of the 'defs-autocomplete' tool, including title, description, input schema, and inline handler function that fetches autocomplete results from the Macrostrat /defs/autocomplete endpoint.
    server.registerTool(
      "defs-autocomplete",
      {
        title: "Definitions Autocomplete",
        description: "Quickly retrieve all definitions matching a query. Limited to 100 results",
        inputSchema: {
          query: z.string().describe("the search term"),
        }
      },
      async (request) => {
        const { query } = request;
        const params = new URLSearchParams({ query });
        const response = await fetch(`${getApiEndpoint("base")}/defs/autocomplete?${params}`);
        const data = await response.json();
    
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify(data, null, 2)
          }]
        };
      }
    );
  • Handler function for 'defs-autocomplete' tool: extracts query param, fetches from Macrostrat API /defs/autocomplete endpoint, returns JSON response as text content.
    async (request) => {
      const { query } = request;
      const params = new URLSearchParams({ query });
      const response = await fetch(`${getApiEndpoint("base")}/defs/autocomplete?${params}`);
      const data = await response.json();
    
      return {
        content: [{
          type: "text" as const,
          text: JSON.stringify(data, null, 2)
        }]
      };
    }
  • Input schema for 'defs-autocomplete' tool using Zod: requires a 'query' string parameter.
      inputSchema: {
        query: z.string().describe("the search term"),
      }
    },
  • Helper function getApiEndpoint used by the tool handler to resolve the base Macrostrat API URL ('base' type).
    function getApiEndpoint(type: "mapUnits" | "units" | "columns" | "base"): string {
      const endpoint = ROOTS.find((root) => {
        if (root.type !== "api") return false;
        switch (type) {
          case "mapUnits":
            return root.uri === "https://macrostrat.org/api/geologic_units/map";
          case "units":
            return root.uri === "https://macrostrat.org/api/units";
          case "columns":
            return root.uri === "https://macrostrat.org/api/columns";
          case "base":
            return root.uri === "https://macrostrat.org/api";
          default:
            return false;
        }
      });
    
      if (!endpoint) {
        throw new Error(`API endpoint not found for type: ${type}`);
      }
    
      return endpoint.uri;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses the result limit ('Limited to 100 results'), which is useful behavioral context. However, it lacks details on permissions, rate limits, error handling, or what 'definitions' refer to in this context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with two sentences that efficiently convey the core functionality and a key constraint. Every word earns its place, and it's front-loaded with the main purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple search tool with one parameter and no output schema, the description is minimally adequate. It explains what the tool does and a limitation, but lacks context on what 'definitions' are, how results are formatted, or how it differs from siblings, leaving gaps for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage with a clear description for the 'query' parameter. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('retrieve') and resource ('definitions matching a query'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'defs', 'find-columns', or 'find-units', which might have overlapping search functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'defs' or other search-related siblings. It mentions a result limit ('Limited to 100 results'), but this doesn't help the agent choose between tools in context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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