Skip to main content
Glama

chat

Build and refine AI workflows through natural language conversation. Describe your workflow needs in plain English to get structured recommendations, integration guidance, and iterative design support without manual JSON construction.

Instructions

Send a message to the AgentLed AI agent and get a response. The agent can reason, plan, and build workflows through natural language conversation — no need to construct pipeline JSON manually.

Use this tool when you want to:

  • Build a workflow from a high-level description ("Create a lead enrichment workflow for SaaS companies")

  • Get recommendations on how to structure a workflow

  • Ask questions about available integrations or capabilities

  • Iterate on workflow design through conversation

The agent has access to the same planning tools, workflow builder, and workspace context as the in-app chat.

For multi-turn conversations, pass the session_id returned from the first message to maintain context across messages.

Example: chat("Build me a workflow that takes a LinkedIn company URL, enriches the data, and scores it by ICP fit")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesThe message to send to the AI agent
session_idNoSession ID for multi-turn conversations. Use the session_id from a previous response to continue the same conversation.

Implementation Reference

  • The async handler function for the 'chat' tool that calls the agent API.
    async ({ message, session_id }, extra) => {
        const client = clientFactory(extra);
        try {
            const result = await client.chat(message, session_id);
    
            if (result.error) {
                return {
                    content: [{
                        type: 'text' as const,
                        text: `Chat error: ${result.error}`,
                    }],
                    isError: true,
                };
            }
    
            return {
                content: [{
                    type: 'text' as const,
                    text: result.response || JSON.stringify(result, null, 2),
                }],
            };
        } catch (error: any) {
            return {
                content: [{
                    type: 'text' as const,
                    text: `Chat request failed: ${error?.message || 'Unknown error'}`,
                }],
                isError: true,
            };
        }
    }
  • Registration function for the 'chat' tool using server.tool.
    export function registerChatTools(server: McpServer, clientFactory: ClientFactory) {
    
        server.tool(
            'chat',
            `Send a message to the AgentLed AI agent and get a response. The agent can reason, plan, and build workflows through natural language conversation — no need to construct pipeline JSON manually.
    
    Use this tool when you want to:
    - Build a workflow from a high-level description ("Create a lead enrichment workflow for SaaS companies")
    - Get recommendations on how to structure a workflow
    - Ask questions about available integrations or capabilities
    - Iterate on workflow design through conversation
    
    The agent has access to the same planning tools, workflow builder, and workspace context as the in-app chat.
    
    For multi-turn conversations, pass the session_id returned from the first message to maintain context across messages.
    
    Example: chat("Build me a workflow that takes a LinkedIn company URL, enriches the data, and scores it by ICP fit")`,
            {
                message: z.string().describe('The message to send to the AI agent'),
                session_id: z.string().optional().describe('Session ID for multi-turn conversations. Use the session_id from a previous response to continue the same conversation.'),
            },
            async ({ message, session_id }, extra) => {
                const client = clientFactory(extra);
                try {
                    const result = await client.chat(message, session_id);
    
                    if (result.error) {
                        return {
                            content: [{
                                type: 'text' as const,
                                text: `Chat error: ${result.error}`,
                            }],
                            isError: true,
                        };
                    }
    
                    return {
                        content: [{
                            type: 'text' as const,
                            text: result.response || JSON.stringify(result, null, 2),
                        }],
                    };
                } catch (error: any) {
                    return {
                        content: [{
                            type: 'text' as const,
                            text: `Chat request failed: ${error?.message || 'Unknown error'}`,
                        }],
                        isError: true,
                    };
                }
            }
        );
    }
  • Input validation schema for the 'chat' tool using Zod.
    {
        message: z.string().describe('The message to send to the AI agent'),
        session_id: z.string().optional().describe('Session ID for multi-turn conversations. Use the session_id from a previous response to continue the same conversation.'),
    },

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/Agentled/mcp-server'

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