Ai Tools

AI tools with MCP in practice

Björn NybergAI3 min läsning

You are chatting with your language model and don't think it's updated enough or lacks information. Perhaps it suggests something, but why doesn't it do anything about it?

Contents

In the previous article, we went through how you as an organization can adapt your site to other AI models. In this text, we discuss how you can optimize and adapt your own models.

One way to expand what your language model can do is what is called tools or function calling. Here we go through a bit about how tools work and how you can build them yourself with a focus on an open protocol called Model Context Protocol (MCP).

Tools

Tools, which are used to extend what a language model can do, can be divided into two groups;

Information Retrieval. Tools in this group can retrieve information from external sources such as databases, the web, file systems. The goal is to extend the knowledge beyond what is already in the model so that it can answer questions whose answers are not included in the model. This could be information that was not available when the model was created or private information that could not be used when the model was created.

Taking Action. Tools in this group can perform actions, such as sending emails, creating messages on Slack, booking a lunch, ordering new parts, or triggering a process. The goal is to automate a task that would otherwise require human labor.

How to create an AI-Tool

To create an AI-tool, there is a standard Model Context Protocol (MCP) that we focus on in this article, but there are also other options such as:

Model Context Protocol (MCP)

MCP provides a standard for applications to share contextual information with language models, offer tools and functions to AI systems, and build composite integrations and workflows.

The protocol uses JSON-RPC 2.0 to communicate between

  • Hosts: LLMs that initiate connections

  • Clients: Connections in the host application to servers

  • Servers: Services that provide context and functions

There are three different transport methods for MCP communication, where we recommend using Streamable HTTP or STDIO.

Streamable HTTP uses HTTP POST for client-to-server messages and optional Server-Sent Events for streaming functions. Streamable HTTP also offers remote server communication and supports standard HTTP authentication methods. MCP recommends using OAuth to obtain authentication tokens.

STDIO uses standard I/O streams for direct communication between processes on the same machine. This provides optimal performance and no network overhead. (SSE should no longer be used; Streamable HTTP is for remote servers).

Functions

A server offers the following functions to clients:

  • Resources: Context and data for users or the AI model to use

  • Prompts: Templated messages and workflows for use in the model

  • Tools: Functions that the AI model can execute

Clients can offer the following functions to servers:

  • Sampling: Allows the server to request responses from the client's AI model. Useful when the server's creator wants access to an LLM but remains independent of a specific model.

  • Logging: Server can send log messages for debugging or monitoring

  • Elicitation: The server needs more information from the user. Useful when more information is needed from the user or to get permission to perform a function.

Why is MCP important?

What MCP offers depends on your role;

  • For Developers, MCP makes it easier and faster to integrate with an AI application or agent.

  • For AI applications and agents, MCP offers an ecosystem of data sources, tools, and applications that provide extended capabilities and improve the user experience for end-users.

  • For End-users, MCP provides better AI applications and agents that can use your data and perform functions for you.

Martin Holmberg

CEO / CEO

Contact Martin for more information on how we can help you.

Martin Holmberg

martin.holmberg@arkido.se

+46 702 580 755