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
| Name | Required | Description | Default |
|---|---|---|---|
| chainId | Yes |
Implementation Reference
- src/module.ts:388-403 (handler)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, }, ], }; }
- src/schemas.ts:144-170 (schema)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, }, ], }; } );