Skip to main content
Glama
getContractsWithHoldings.ts1.6 kB
import { z } from "zod"; import axios, { AxiosResponse } from "axios"; import { baseUri, chainName } from "../../constants"; export default function (server: any) { server.tool( "getContractsWithHoldings", "Gets a list of contracts containing specific token with defined threshold.", { chainName: z.literal(chainName), token_address: z.string().describe("Token address to fetch contracts for"), authToken: z .string() .describe("Authorization token for accessing the Somnia API"), }, { title: "Get Contracts With Holdings", readOnlyHint: true, description: "Fetch a list of contracts containing specific token with defined threshold.", destructiveHint: false, }, async (args:any) => { const { chainName, token_address, authToken } = args; try { const response: AxiosResponse<any> = await axios.get( `${baseUri}/${chainName}/v1/tokens/${token_address}/contract/list`, { headers: { Authorization: `Bearer ${authToken}`, "Content-Type": "application/json", Accept: "application/json", }, } ); return { content: [ { type: "text", text: `Contracts With Holdings Data: ${JSON.stringify( response.data )}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error fetching contracts with holdings: ${error}`, }, ], }; } } ); }

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/vastavikadi/somnia-mcp'

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