Skip to main content

How MCP and LLM tool calls work

Picture of Adam Warski, Chief R&D Officer at <a href="https://softwaremill.com/">SoftwareMill</a>

Adam Warski

Chief R&D Officer at SoftwareMill
Aug 11, 2025|7 min read
How_MCP_and_LLM_tool_calls_work_cover.jpg
1In this environment you have access to a set of tools
2you can use to answer the user's question.
3You can invoke functions by writing a "<antml:function_calls>" block
4like the following as part of your reply to the user:
5
6<antml:function_calls>
7<antml:invoke name="$FUNCTION_NAME">
8<antml:parameter name="$PARAMETER_NAME">$PARAMETER_VALUE</antml:parameter>
9...
10</antml:invoke>
11<antml:invoke name="$FUNCTION_NAME2">
12...
13</antml:invoke>
14</antml:function_calls>
1Here are the functions available in JSONSchema format:
2
3<functions>
4<function>{
5 "description": "Fetch the contents of a web page at a given URL. "
6 "This function can only fetch EXACT URLs that have been provided directly by the user "
7 "or have been returned in results from the web_search and web_fetch tools. "
8 "This tool cannot access content that requires authentication, such as private Google Docs "
9 "or pages behind login walls. "
10 "Do not add www. to URLs that do not have them. "
11 "URLs must include the schema: https://example.com is a valid URL while example.com is an invalid URL.",
12 "name": "web_fetch",
13 "parameters": {
14 "additionalProperties": false,
15 "properties": {
16 "url": {
17 "title": "Url",
18 "type": "string"
19 }
20 },
21 "required": ["url"],
22 "title": "AnthropicFetchParams",
23 "type": "object"
24 }
25}</function>
26(...)
27</functions>
Image Alt

1Claude has access to web_search and other tools for info retrieval.
2The web_search tool uses a search engine and returns results in
3<function_results> tags.
traffic between cursor and chatGPT

Prompt from claude

Image Alt

1{
2 "type": "function",
3 "function": {
4 "name": "mcp_context7_resolve-library-id",
5 "description": "Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries.\n\nYou MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID (...)",
6 "parameters": {
7 "type": "object",
8 "properties": {
9 "libraryName": {
10 "type": "string",
11 "description": "Library name to search for and retrieve a Context7-compatible library ID."
12 }
13 },
14 "required": [
15 "libraryName"
16 ],
17 "additionalProperties": false,
18 "$schema": "http://json-schema.org/draft-07/schema#"
19 }
20 }
21},

Subscribe to our newsletter and never miss an article

Explore more topics