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(Link for reference: [https://example.com](https://example.com))
3
4<functions>
5<function>{
6 "description": [
7 "Fetch the contents of a web page at a given URL.",
8 "This function can only fetch EXACT URLs that have been provided directly by the user,",
9 "or have been returned in results from the web_search and web_fetch tools.",
10 "This tool cannot access content that requires authentication, such as private Google Docs or pages behind login walls.",
11 "Do not add www. to URLs that do not have them.",
12 "URLs must include the schema: https://example.com is a valid URL while example.com is an invalid URL."
13 ],
14 "name": "web_fetch",
15 "parameters": {
16 "additionalProperties": false,
17 "properties": {
18 "url": {
19 "title": "Url",
20 "type": "string"
21 }
22 },
23 "required": ["url"],
24 "title": "AnthropicFetchParams",
25 "type": "object"
26 }
27}</function>
28(...)
29</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": [
6 "Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries.",
7 "You MUST call this function before `get-library-docs` to obtain a valid Context7-compatible library ID (...)"
8 ],
9 "parameters": {
10 "type": "object",
11 "properties": {
12 "libraryName": {
13 "type": "string",
14 "description": "Library name to search for and retrieve a Context7-compatible library ID."
15 }
16 },
17 "required": [
18 "libraryName"
19 ],
20 "additionalProperties": false,
21 "$schema": "http://json-schema.org/draft-07/schema#"
22 }
23 }
24}

Subscribe to our newsletter and never miss an article