defs-autocomplete
Retrieve up to 100 geologic definitions matching a search query using the Macrostrat MCP Server for comprehensive geologic data access.
Instructions
Quickly retrieve all definitions matching a query. Limited to 100 results
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | the search term |
Implementation Reference
- src/index.ts:1010-1022 (handler)The tool handler: extracts 'query' from request, fetches autocomplete data from Macrostrat API `/defs/autocomplete`, parses JSON, and returns formatted 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) }] }; }
- src/index.ts:1003-1009 (schema)Tool schema defining title, description, and inputSchema with 'query' as required string using Zod validation.{ title: "Definitions Autocomplete", description: "Quickly retrieve all definitions matching a query. Limited to 100 results", inputSchema: { query: z.string().describe("the search term"), } },
- src/index.ts:1001-1023 (registration)Registration of the 'defs-autocomplete' tool using server.registerTool with schema and inline handler function.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) }] }; } );