1. Học hỏi
  2. /
  3. Khoa Học
  4. /
  5. Introduction to Model Context Protocol (MCP)

Connected

Bài tập

LLM Tool Use in MCP Servers

You've built an MCP server containing a tool for converting currencies using up-to-date exchange rates. Integrating it with an LLM will give it the ability to accurately answer questions about currencies and exchange rates—something it can't do by default.

The bulk of the code is provided for you here, as the main focus should be on understanding the workflow rather than syntax.

Hướng dẫn

100 XP
  • Send the user query (user_query) and formatted list of tools (openai_tools) to the OpenAI LLM.
  • Call the MCP tool chosen by the LLM, using the name and arguments extracted from the response output (output).
  • Send the result (result) back to the OpenAI model for final response.