ethora-app-create-chat
Enable users to create new chats within their applications, specifying app IDs, chat titles, and pin preferences for organized communication.
Instructions
Create a new chat for the logged-in user who has created the app.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appId | Yes | appId for app | |
| pinned | Yes | pinned for chat | |
| title | Yes | title for chat |
Implementation Reference
- src/tools.ts:234-260 (registration)Registration of the 'ethora-app-create-chat' tool including schema definition and handler function that invokes the API to create a chat.function craeteAppChatTool(server: McpServer) { server.registerTool( 'ethora-app-create-chat', { description: 'Create a new chat for the logged-in user who has created the app.', inputSchema: { appId: z.string().describe("appId for app"), title: z.string().describe("title for chat"), pinned: z.boolean().describe("pinned for chat"), } }, async function ({ appId, title, pinned }) { try { let result = await appCreateChat(appId, title, pinned) let toolRes: CallToolResult = { content: [{ type: "text", text: JSON.stringify(result.data) }] } return toolRes } catch (error) { let toolRes: CallToolResult = { content: [{ type: "text", text: "error: network error" }] } return toolRes } } ) }
- src/tools.ts:245-258 (handler)The core handler function for the ethora-app-create-chat tool, which calls appCreateChat and formats the response.async function ({ appId, title, pinned }) { try { let result = await appCreateChat(appId, title, pinned) let toolRes: CallToolResult = { content: [{ type: "text", text: JSON.stringify(result.data) }] } return toolRes } catch (error) { let toolRes: CallToolResult = { content: [{ type: "text", text: "error: network error" }] } return toolRes } }
- src/tools.ts:237-244 (schema)Input schema and description for the ethora-app-create-chat tool using Zod.{ description: 'Create a new chat for the logged-in user who has created the app.', inputSchema: { appId: z.string().describe("appId for app"), title: z.string().describe("title for chat"), pinned: z.boolean().describe("pinned for chat"), } },
- src/apiClientDappros.ts:157-165 (helper)Helper function appCreateChat that performs the HTTP POST request to create the chat via the API endpoint.export function appCreateChat(appId: string, title: string, pinned: boolean) { return httpClientDappros.post( `/apps/create-app-chat/${appId}`, { title, pinned } ) }