Skip to content

Chat MCP example #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Chat MCP example #143

wants to merge 2 commits into from

Conversation

luv-bansal
Copy link
Contributor

No description provided.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds an example chat agent that integrates Clarifai’s LLM models with MCP tools, enabling interactive queries and tool-driven responses.

  • Introduce project dependencies in requirements.txt
  • Implement client.py with LLMClient, tool discovery, execution, and chat session orchestration
  • Provide setup, usage, and architecture details in README.md

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
agents/mcp/chat-mcp-agent/requirements.txt Added required packages: fastmcp, openai, python-dotenv, langchain-core
agents/mcp/chat-mcp-agent/client.py New chat client implementation with LLM integration and tool management
agents/mcp/chat-mcp-agent/README.md Documentation for setup, usage, and architecture of the example

@luv-bansal luv-bansal requested a review from Copilot May 30, 2025 10:22
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces an interactive chat agent that integrates Clarifai's LLM with MCP tools for executing tool calls and processing natural language responses. Key changes include adding the required dependencies in requirements.txt, implementing the core client and chat session logic in client.py, and providing clear documentation in the README.md.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
agents/mcp/chat-mcp-agent/requirements.txt Adds dependency specifications for Clarifai, LangChain, fastmcp, and OpenAI.
agents/mcp/chat-mcp-agent/client.py Implements LLMClient, tool formatting, asynchronous tool calls, and an interactive chat loop.
agents/mcp/chat-mcp-agent/README.md Provides comprehensive setup, usage, and component architecture documentation.

arguments
)
result = await server.call_tool_mcp(tool_name, arguments)
result_data = result.model_dump()['content'][0]
Copy link
Preview

Copilot AI May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing the first element of 'content' without validating it may lead to an IndexError if the response structure is not as expected. Consider adding a check to ensure the list is non-empty.

Copilot uses AI. Check for mistakes.

@zeiler
Copy link
Member

zeiler commented May 30, 2025

do we need this one still? looks like on is already merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants