Search⌘ K
AI Features

Adding the Prompt Feature to the MCP Application

Explore adding prompt capabilities to an MCP application by defining server-side prompt templates and enabling client-side discovery and invocation. Learn how prompts guide AI reasoning with flexible instructions for summarization and prioritization, improving agent intelligence beyond fixed tool actions.

We previously built an MCP server with callable tools and connected it to a LangGraph-based client. While tools are well-suited for direct actions (e.g., “fetch section content”), real-world assistants often require more flexible behavior, such as reasoning about relevance or summarizing a list. This is where prompts come into play.

MCP prompts allow developers to expose custom LLM instructions as invocable interfaces. Unlike tools, prompts don’t perform actions. Instead, the server renders them into messages that shape the model’s behavior during inference. In this lesson, we’ll implement a prompt that helps users identify the most important sections of a Wikipedia article and explore how it integrates into the server–client workflow.

What are prompts in MCP?

In MCP, prompts are predefined text templates that guide the behavior of a language model. Whereas tools are invoked and executed server-side to produce structured outputs, prompts are passive: when requested, the server fills in the template and returns it as one or more messages. This string typically contains a carefully crafted instruction injected into the LLM’s context.

MCP prompts workflow
MCP prompts workflow

Prompts are particularly useful when:

  • The task requires summarization, prioritization, or natural language reasoning.

  • The user’s intent is best expressed as instructions for the model rather than as a fixed sequence of tool calls.

MCP prompts are:

  • Defined, hosted, and rendered on the server, but used by the client and LLM.

  • Discovered by the client, just like tools, but typically selected by the user rather than the model.

  • Parameterized so users can pass in structured inputs like topic: str.

  • Template-based, returning messages to add to the conversation rather than the result of an action.

In this part of the lesson, we’ll define a prompt that takes a Wikipedia topic as input and returns a prompt string instructing the assistant to identify the most important sections of the article.

Adding a prompt to the server

To define a prompt in MCP, we use ...