Skip to main content
Glama

chaingpt_invoke_chat

Ask blockchain questions to get AI-powered answers about crypto markets, smart contracts, DeFi protocols, and on-chain analytics using specialized Web3 data.

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

TableJSON Schema
NameRequiredDescriptionDefault
questionYes
chatHistoryYes

Implementation Reference

  • The asynchronous handler function that executes the tool logic. It calls ChainGPT's createChatBlob API with the question and optional chatHistory, formats the response as MCP content, and handles errors by returning an error message.
    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, }; } }
  • The server.tool registration call that registers the 'chaingpt_invoke_chat' tool with its description, input schema, and handler function.
    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, }; } } );
  • Zod schema for the tool's input parameters: 'question' (required string) and 'chatHistory' (optional string).
    export const chatSchema = { question: z.string().min(1, 'Question is required'), chatHistory: z.string(), }
  • Instantiation of the GeneralChat SDK client used by the handler, configured with the ChainGPT API key from config.
    const generalchat = new GeneralChat({ apiKey: config.chaingpt.secretKey, });

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/kohasummons/chaingpt-mcp'

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