Day 31/90 Days of AI Engineering: MCP Tools vs Resources vs Prompts
DEV Community

Day 31/90 Days of AI Engineering: MCP Tools vs Resources vs Prompts

One thing I'm learning while exploring the Model Context Protocol (MCP) is that connecting an LLM to external systems is not just about exposing functions.

MCP provides three important server primitives: Tools, Resources, and Prompts. Although they can work together, each serves a different purpose. Let's understand them through a practical example.

MCP Tools - Let AI take action

Tools are executable functions that an AI model can discover and invoke. They are useful when an application needs to perform an operation or interact with an external system.

Examples:

  • Search a knowledge base.
  • Query a database.
  • Create a support ticket.
  • Call an external API.

In a document support assistant, a tool could be:

create_support_ticket(customer_id, issue)

The model can request this operation when the user's problem requires human support.

Key idea: Tools enable action.

MCP Resources - Give AI access to context

Resources expose structured information that an AI application can retrieve and use as context. They are useful when the model needs information rather than an action.

Examples:

  • Product documentation.
  • Company policies.
  • Database schemas.
  • Knowledge base documents.

In our document support assistant, a resource could be:

company://policies/refund

The application can retrieve the refund policy and provide its contents to the model.

Key idea: Resources provide context.

MCP Prompts - Provide reusable instructions

Prompts are predefined templates exposed by an MCP server. They help users initiate consistent, structured interactions with an AI model.

Examples:

  • Summarize a document.
  • Analyze a support request.
  • Draft a customer response.
  • Generate a report.

For our support assistant, we could define a prompt:

draft_support_reply(issue, customer_context)

This provides a reusable structure for generating a customer support response.

Key idea: Prompts provide reusable interaction templates.

How do they work together?

Imagine a customer asks: "Can I get a refund for my order?" A possible interaction looks like this:

  • Resource: Retrieve the company's refund policy.
  • Tool: Check the order details or refund eligibility.
  • Prompt: Use a predefined template to generate a clear customer response.

The application combines contextual information, external operations, and reusable instructions to complete the interaction.

Quick Comparison

Primitive Purpose Control
Tools Execute operations Model
Resources Provide context Application
Prompts Reusable templates User

Engineering Takeaway

The biggest lesson for me is that these three primitives should not be treated as interchangeable.

  • Need to perform an operation? Use a Tool.
  • Need to provide information? Use a Resource.
  • Need a reusable interaction template? Use a Prompt.

Also, exposing a tool does not mean it should automatically be trusted. Sensitive operations need appropriate authorization and human approval where necessary.

MCP is not simply about connecting tools to LLMs. It's about creating a standardized way to expose actions, context, and interaction patterns.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.