chaingpt_invoke_chat
Ask crypto-related questions to ChainGPT AI and receive informed responses based on blockchain data. Supports chat history for conversational context. Ideal for market insights, on-chain analytics, and trading assistance.
Instructions
Invoke a chat with ChainGPT AI and get a response based on the provided question.
Web3-native AI assistant built specifically for the crypto world.
It has deep blockchain expertise, enabling seamless integration of crypto-aware AI into your applications.
The model is trained on blockchain data (smart contracts, DeFi protocols, NFTs, DAOs) and real-time market information,
making it ideal for use cases like customer support, on-chain analytics, trading assistance, and community engagement
Capabilities:
- Aggregate any amount of web3 market statistics
- Interact with Blockchains
- Live information tracking of 5,000+ cryptos.
- AI Generated News
⚠️ COST WARNING: This tool makes an API call to ChainGPT which may incur costs.
This tool allows you to interact with ChainGPT's conversational AI capabilities.
Args:
question (str): The question or message to send to ChainGPT.
chatHistory (str, optional): Whether to include chat history in the request.
Defaults to "off" if not provided. Can be set to "on" to maintain conversation context.
sdkUniqueId (str, optional): The unique identifier for the chat.
Defaults to a random UUID if not provided
Returns:
The response from ChainGPT AI to the provided question or message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| question | Yes | ||
| chatHistory | Yes |
Implementation Reference
- src/tools/chat.ts:40-68 (handler)The async handler function that executes the chaingpt_invoke_chat tool. It receives params (question, chatHistory), calls generalchat.createChatBlob(), and returns the response text. Includes error handling that returns an error message if the API call fails.
async (params) => { try { const response = await generalchat.createChatBlob({ question: params.question, chatHistory: params.chatHistory, }); return { content: [ { type: "text", text: response.data.bot, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "invoke_chat_Unknown_Error"; return { content: [ { type: "text", text: errorMessage, }, ], isError: true, }; } } ); - src/tools/chat.ts:10-68 (registration)The registerChatTools function registers 'chaingpt_invoke_chat' via server.tool() with its description, schema, and handler. Called from src/tools/index.ts -> src/index.ts to wire up the MCP server.
export const registerChatTools = () => { server.tool( "chaingpt_invoke_chat", ` Invoke a chat with ChainGPT AI and get a response based on the provided question. Web3-native AI assistant built specifically for the crypto world. It has deep blockchain expertise, enabling seamless integration of crypto-aware AI into your applications. The model is trained on blockchain data (smart contracts, DeFi protocols, NFTs, DAOs) and real-time market information, making it ideal for use cases like customer support, on-chain analytics, trading assistance, and community engagement Capabilities: - Aggregate any amount of web3 market statistics - Interact with Blockchains - Live information tracking of 5,000+ cryptos. - AI Generated News ⚠️ COST WARNING: This tool makes an API call to ChainGPT which may incur costs. This tool allows you to interact with ChainGPT's conversational AI capabilities. Args: question (str): The question or message to send to ChainGPT. chatHistory (str, optional): Whether to include chat history in the request. Defaults to "off" if not provided. Can be set to "on" to maintain conversation context. sdkUniqueId (str, optional): The unique identifier for the chat. Defaults to a random UUID if not provided Returns: The response from ChainGPT AI to the provided question or message. `, chatSchema, async (params) => { try { const response = await generalchat.createChatBlob({ question: params.question, chatHistory: params.chatHistory, }); return { content: [ { type: "text", text: response.data.bot, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "invoke_chat_Unknown_Error"; return { content: [ { type: "text", text: errorMessage, }, ], isError: true, }; } } ); - src/types/schema.ts:3-6 (schema)Zod schema for chaingpt_invoke_chat: defines 'question' (required string) and 'chatHistory' (string) as input parameters.
export const chatSchema = { question: z.string().min(1, 'Question is required'), chatHistory: z.string(), } - src/tools/chat.ts:6-8 (helper)Initialization of GeneralChat client with the API key from config, used by the tool handler to make API calls to ChainGPT.
const generalchat = new GeneralChat({ apiKey: config.chaingpt.secretKey, });