Skip to main content
Glama
AdamikHQ

Adamik MCP Server

Official

getChainValidators

Retrieve the list of validators for a specific blockchain network to help users select a validator for delegation.

Instructions

Gets the list of known validators for a given chain. This is only useful when asking the user to select a validator to delegate to

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainIdYes

Implementation Reference

  • The handler function that implements the core logic: fetches validator list from Adamik API for the specified chainId, handles optional nextPage pagination, stringifies the response as text content.
    async ({ chainId, nextPage }: GetChainValidatorsPathParams & GetChainValidatorsQueryParams) => {
      const validators = await makeApiRequest<GetChainValidatorsResponse>(
        `${ADAMIK_API_BASE_URL}/${chainId}/validators${nextPage ? `?nextPage=${nextPage}` : ""}`,
        ADAMIK_API_KEY
      );
      const text = JSON.stringify(validators);
    
      return {
        content: [
          {
            type: "text",
            text,
          },
        ],
      };
    }
  • Zod schemas defining input (path/query params), output response structure, Validator and Pagination components for getChainValidators tool.
    export const ValidatorSchema = z.object({
      address: z.string(),
      name: z.string(),
      commission: z.number().optional(),
      stakedAmount: z.string().optional(),
    });
    
    export const PaginationSchema = z.object({
      nextPage: z.string().nullable(),
    });
    
    export const GetChainValidatorsPathParamsSchema = z.object({
      chainId: ChainIdSchema,
    });
    export type GetChainValidatorsPathParams = z.infer<typeof GetChainValidatorsPathParamsSchema>;
    
    export const GetChainValidatorsQueryParamsSchema = z.object({
      nextPage: z.string().optional(),
    });
    export type GetChainValidatorsQueryParams = z.infer<typeof GetChainValidatorsQueryParamsSchema>;
    
    export const GetChainValidatorsResponseSchema = z.object({
      chainId: ChainIdSchema,
      validators: z.array(ValidatorSchema),
      pagination: PaginationSchema,
    });
    export type GetChainValidatorsResponse = z.infer<typeof GetChainValidatorsResponseSchema>;
  • src/module.ts:382-404 (registration)
    Registers the getChainValidators tool on the MCP server with name, description, input parameters schema, and inline handler function.
    server.tool(
      "getChainValidators",
      "Gets the list of known validators for a given chain. This is only useful when asking the user to select a validator to delegate to",
      {
        chainId: ChainIdSchema,
      },
      async ({ chainId, nextPage }: GetChainValidatorsPathParams & GetChainValidatorsQueryParams) => {
        const validators = await makeApiRequest<GetChainValidatorsResponse>(
          `${ADAMIK_API_BASE_URL}/${chainId}/validators${nextPage ? `?nextPage=${nextPage}` : ""}`,
          ADAMIK_API_KEY
        );
        const text = JSON.stringify(validators);
    
        return {
          content: [
            {
              type: "text",
              text,
            },
          ],
        };
      }
    );

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/AdamikHQ/adamik-mcp-server'

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