What is tool calling in AI? Tool vs function calling, LangChain, MCP and Gemma

Tool calling lets a model request external tools with structured arguments. How it works, vs function calling, LangChain, agents, MCP and Gemma.

Pranjul Rathour
Pranjul Rathour

Key takeaways

  • Tool calling lets a language model request that your application run a tool, such as a search, database query or API call, with structured arguments.
  • Tool calling and function calling mean essentially the same thing; 'tools' is the broader, newer term.
  • In LangChain, you define tools, bind them to a chat model, and run the calls the model requests.
  • A single tool call is not agentic; an agent is a loop where the model chooses tools repeatedly towards a goal.
  • MCP is a protocol for providing tools to models; the model still uses tool calling to invoke them.

Tool calling is how a language model uses external tools: you describe tools to the model, it decides when one is needed and returns a structured request with arguments, your application runs the tool, and the result goes back to the model so it can continue. Tools can be anything code can do: search, calculators, databases, APIs, file operations or other agents. This page explains tool calling in AI and how it works, how it relates to function calling, tool-calling models, LangChain, agentic AI, MCP, and whether Gemma supports it.

What is tool calling?

Tool calling is a capability of language models to request the use of external tools by producing a structured call, usually a tool name and JSON arguments, instead of plain text. The application executes the tool and returns the result to the model.

Also asked as: how tool calling works

This bridges the gap between language and action. A model cannot check today's train timings or query your database by itself, but with a search_trains(from, to, date) tool it can request exactly that, then answer from real data. Tool calling also makes structured output reliable, because arguments must match a schema. It is the foundation of AI agents and of integrations such as coding assistants that edit files and run tests.

What is tool calling in AI?

In AI, tool calling extends a model's abilities beyond its training data and text generation, letting it retrieve live information, compute precisely and take actions in other systems, under the control of the application.

Examples include chatbots that look up orders, assistants that schedule meetings, coding agents that read files and run commands, research agents that search the web, and data assistants that run SQL queries. In each, the model decides what to call and with what arguments, and the application decides what is allowed. Good systems keep sensitive actions behind confirmations and log every call for review.

How does tool calling work?

You send the model the conversation plus tool definitions with names, descriptions and input schemas. The model either answers or returns one or more tool calls. Your code validates and runs them, adds the results to the conversation, and calls the model again.

The loop in steps:

  • Define tools clearly: what each does and when to use it.
  • Send the user message and tool list to the model.
  • If the model returns tool calls, validate arguments and execute.
  • Return results to the model, marked as tool results.
  • Repeat until the model gives a final answer, with a step limit.

Tool descriptions are the most important prompt in this process: models choose tools by reading them.

What is the difference between tool calling and function calling?

They mean essentially the same thing. "Function calling" was the name OpenAI used when it launched the feature in 2023; "tool calling" or "tool use" is the broader term now used by most providers, since tools also include built-in capabilities such as web search and code execution.

In practice, a "function" is one kind of tool: a custom operation you define with a JSON schema. Providers also offer server-side tools they run themselves, such as search or code interpreters, alongside your functions. APIs and frameworks use both terms, sometimes interchangeably, so do not let naming confuse you: the concept is the model requesting a structured action that the system performs.

What are tool-calling models?

Tool-calling models are language models trained to decide when to use tools and to produce correctly formatted tool calls. Most current major models support it, including models from OpenAI, Anthropic, Google and Mistral, and many open-weight models.

Also asked as: what are tool calling models

Quality differs in choosing the right tool, producing valid arguments, handling many tools, and calling tools in sequence for multi-step tasks. Frontier models are generally most reliable; smaller open models work for simple tool sets. Leaderboards for function calling compare models, but testing with your own tools and tasks is essential. When running open models locally, check that the model and serving tool, such as Ollama or vLLM, support tool calling.

What is tool calling in LangChain?

In LangChain, tool calling means defining tools, often with the @tool decorator on a Python function, binding them to a chat model with bind_tools, and handling the tool calls the model returns, either manually or through an agent that runs the loop.

from langchain_core.tools import tool
from langchain.chat_models import init_chat_model

@tool
def add(a: int, b: int) -> int:
    """Add two integers."""
    return a + b

llm = init_chat_model("anthropic:claude-sonnet-5-5").bind_tools([add])
msg = llm.invoke("What is 19 + 23?")
print(msg.tool_calls)     # [{'name': 'add', 'args': {'a': 19, 'b': 23}, ...}]

LangChain standardises tool calls across providers, so the same code works with different models. Check the docs for current model names.

What is tool calling in agentic AI?

In agentic AI, tool calling is the mechanism through which agents act: the agent repeatedly reasons about the goal, calls tools, observes results and decides the next step, until the task is complete or it needs a person.

The quality of an agent depends heavily on its tools: a small set of well-designed, clearly described tools with good error messages works far better than many overlapping ones. Agents also need guardrails around tool calls: permission checks, confirmation for destructive actions, limits on steps and cost, and defences against prompt injection from tool results. Logging every call makes debugging and auditing possible.

Is tool calling agentic?

A single tool call is not agentic by itself; it is one structured request. A system becomes agentic when the model uses tool calls in a loop, choosing which tools to use and when, to pursue a goal across multiple steps.

For example, a chatbot that always calls a weather API for weather questions is tool use, not an agent. A system that plans a trip by searching trains, checking hotels, comparing options and asking you to confirm bookings is agentic. Many useful products sit in between: mostly fixed workflows with one or two model-chosen tool calls, which are easier to test and more reliable than fully autonomous agents.

Is MCP tool calling?

MCP, the Model Context Protocol, is not tool calling itself; it is a standard way to provide tools, resources and prompts to AI applications. The model still uses tool calling to invoke MCP tools, while the MCP client handles talking to MCP servers.

In practice: an MCP server exposes tools such as query_database; the AI application, as an MCP client, lists them to the model as available tools; the model returns a tool call; the client forwards it to the server and returns the result. MCP's value is reuse: build a tool once as an MCP server and use it from many assistants and agents, instead of writing separate integrations for each.

Can Gemma do tool calling?

Gemma models can be used for function calling: Google's newer Gemma releases support it through prompting and structured outputs, and serving tools that run Gemma, such as Ollama or Hugging Face libraries, can expose tool calling depending on the model version and template.

Results are best with clear function descriptions, few tools and strict JSON schemas, and with validation in your code. Smaller Gemma sizes make more mistakes on complex tool use than larger hosted models. For production agents needing many tools, test carefully or use a larger model; for simple local tasks, such as routing requests or extracting fields, Gemma can work well. Check Google's Gemma documentation for the current function-calling guidance.

Sources

  1. Anthropic, Tool use overviewdocs.anthropic.com
  2. OpenAI, Function calling guideplatform.openai.com
  3. LangChain, Tool calling conceptspython.langchain.com
  4. Model Context Protocol, documentationmodelcontextprotocol.io
  5. Google AI for Developers, Gemma documentationai.google.dev
Pranjul Rathour
Pranjul Rathour
GenAI Engineer · India

GenAI engineer and AI product builder with 2+ years shipping production-grade AI systems: RAG pipelines, fine-tuned LLMs, hybrid retrieval and multi-modal apps across vision, speech and OCR, architected end to end from ingestion to deployment. Leads engineering for SCULT INDIA's 14-member team, founded the 500+ member TechVerse Enclave community and has mentored 200+ students. Three hackathon first prizes: Changethon 2025 (IIT Roorkee), Product Genesis at Vividhotsava 2025 (CSJMU) and BYTEBATTLE (MeetKats).

Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at colleges. For campus sessions the inviting institution covers the visit end to end: travel (a First AC train ticket for journeys up to five hours, a flight for anything longer), accommodation, meals, and pickup and drop; the honorarium and workshop fees are negotiable on WhatsApp or on the call, and requests are welcome from institutions that can cover the visit this way. Email pranjulrathour41@gmail.com.

Keep reading

More on Shipping AI apps

All Shipping AI apps guides →
Campus talks · hackathon judging · mentoring

Want this as a live session at your college?

Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at colleges. For campus sessions the inviting institution covers the visit end to end: travel (a First AC train ticket for journeys up to five hours, a flight for anything longer), accommodation, meals, and pickup and drop; the honorarium and workshop fees are negotiable on WhatsApp or on the call, and requests are welcome from institutions that can cover the visit this way.

Pranjul Rathour, GenAI engineer in India