Skip to main content
Glama
chat-provider.tsx923 B
"use client"; import { useChat } from "ai/react"; import { createContext, useContext, useState } from "react"; export interface ChatContextType { chat: ReturnType<typeof useChat> | undefined; setChatId: (chatId: string) => void; } const ChatContext = createContext<ChatContextType | undefined>(undefined); function useChatProvider() { const context = useContext(ChatContext); if (context === undefined) { throw new Error("useChatProvider must be used within a ChatProvider"); } return context; } interface ChatConfigProviderProps { children: React.ReactNode; initialData?: Partial<ChatContextType>; } function ChatProvider({ children, initialData = {} }: ChatConfigProviderProps) { const value = { chat: initialData.chat, setChatId: initialData.setChatId, }; return <ChatContext.Provider value={value}>{children}</ChatContext.Provider>; } export { ChatProvider, useChatProvider };

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/madarco/ragrabbit'

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