get_priority_fee
Fetch suggested priority fees to optimize transaction inclusion speed on VeChain mainnet, helping users determine appropriate gas costs for timely block confirmation.
Instructions
Fetch a suggested priority fee for including a transaction in the next blocks from VeChain mainnet.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:410-459 (handler)The async callback function that executes the tool logic: fetches suggested priority fee from VeChain Thorest API /fees/priority endpoint, with timeout and error handling, returns JSON-formatted response.callback: async () => { const base = isMainnet ? vechainConfig.mainnet.thorestApiBaseUrl : vechainConfig.testnet.thorestApiBaseUrl; const url = `${base}/fees/priority`; const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), isMainnet ? vechainConfig.mainnet.controllerAbortTimeout : vechainConfig.testnet.controllerAbortTimeout); try { const res = await fetch(url, { signal: controller.signal }); if (!res.ok) { const bodyText = await res.text().catch(() => ""); throw new Error( `VeChain node responded ${res.status} ${res.statusText}${bodyText ? `: ${bodyText}` : "" }` ); } const data = await res.json(); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; } catch (err) { const isAbort = (err as Error)?.name === "AbortError"; return { content: [ { type: "text", text: JSON.stringify( { error: isAbort ? "Request timed out" : "Failed to fetch priority fee", reason: String((err as Error)?.message ?? err), url, }, null, 2 ), }, ], }; } finally { clearTimeout(timeout); } }
- src/tools.ts:406-409 (schema)Tool metadata and input schema definition (no input parameters required).name: "get_priority_fee", title: "Suggest a priority fee", description: "Fetch a suggested priority fee for including a transaction in the next blocks from VeChain mainnet.", inputSchema: {},
- src/server.ts:74-92 (registration)Registers the get_priority_fee tool (as part of vechainTools loop) to the MCP server, using the defined schema and wrapping the callback handler.for (const t of vechainTools) { server.registerTool( t.name, { title: t.name, description: t.description, inputSchema: t.inputSchema }, async (args) => { const result = await t.callback(args); return { content: result.content.map(item => ({ ...item, type: "text" as const })) }; } ); }