Resource vs Tools

#14
by ayanguha - opened
Hugging Face Context Course org

I am confused between when to use tools vs when to use resource for API response.

  1. In mcp-course, https://huggingface.co/learn/mcp-course/unit1/capabilities#tools it is mentioned under Tools
  2. In mcp website, https://modelcontextprotocol.io/docs/concepts/resources#overview it is mentioned under Resources

which one is correct? What is the best practice? Why is this inconsistency?

The way I usually separate them is:

  • Tools: use when the model is asking the system to do something or compute/fetch something with arguments. The call is an action in the run history.
  • Resources: use when you want to expose addressable context that the client/model can read. The resource is more like a file/document/API-backed object.

So for an API response, I would ask: does the model need to invoke a parameterized operation, or should the response be browseable/readable context?

Example: search_customer_orders(customer_id) feels like a tool. orders://customer/123 or docs://runbook/refunds feels like a resource.

The confusing part is that a tool may internally fetch data from an API, and a resource may be backed by an API too. The difference is less about implementation and more about the contract exposed to the agent.

Sign up or log in to comment