Powerful workflows in Claude using prompts and tools in Model Context Protocol

The Model Context Protocol (MCP) continues to amaze me with all the possibilities it brings to Claude.

With the different MCP capabilities, you don’t need anymore to copy prompts that you have in a text document and then copy and paste content from another file to fit inside the prompt, to finally execute the prompt.

You can now easily implement workflows that can run with a couple of clicks.

prompts server capability in MCP

In the v0.3.0 release of my Golang ModelContextProtocol server SDK, I added a new server capabilities: prompts.

This feature is more powerful when you combine them with the tools server capabilities.

For example, I created a MCP server that implement a tool to retrieve a notion page identified by its page id. The code for this tool is available here.

You can combine this tool with a prompt to create easy to (re)use workflows.

For instance, I created a template like this one:

prompts:
- name: "notionPageSummary"
description: "Summarize the content of a Notion page"
arguments:
- name: "pageId"
description: "the notion page id of the page to summarize"
required: true
prompt: |
You are tasked with creating a concise summary of a notion document.
Your goal is to capture the main ideas and key points while significantly reducing the length of the original text.
Follow these steps to create this summary:
1. retrieve the content of the notion page with the id {{.pageId}}
2. generate a summary
3. the summary must be short, with 2 or 3 paragraphs

This prompt instructs the LLM to use the tool available in the MCP server to retrieve a notion document.

The definition of this tool is:

{
"jsonrpc": "2.0",
"result": {
"tools": [
{
"name": "notion_get_page",
"description": "Get the markdown content of a notion page",
"inputSchema": {
"properties": {
"pageId": {
"type": "string",
"description": "the ID of the Notion page to retrieve."
}
},
"additionalProperties": false,
"type": "object",
"required": [
"pageId"
]
}
}
]
},
"id": 2
}

Usage in Claude

To use this prompt in Claude, you click on the icon of the home page:

That will give you access to the MCP server integrations you have configured and the prompt(s) that this server exposes:

If you click on the prompt, you can provide the parameters that this prompt needs.

In the case of our prompt, that’s the notion page id:

and then you can submit that prompt.

For those interested by the inner working of the MCP server, this will trigger a RPC call to your server:

{
"method": "prompts/get",
"params": {
"name": "notionPageSummary",
"arguments": {
"pageId": "15<redacted>68"
}
},
"jsonrpc": "2.0",
"id": 444
}

and the server will send back the prompt, with the pageId being substituted:

{
"jsonrpc": "2.0",
"result": {
"description": "Summarize the content of a Notion page",
"messages": [
{
"content": {
"text": "You are tasked with creating a concise summary of a notion document. \nYour goal is to capture the main ideas and key points while significantly reducing the length of the original text. \nFollow these steps to create this summary:\n1. retrieve the content of the notion page with the id 15<redacted>68 \n2. generate a summary \n3. the summary must be short, with 2 or 3 paragraphs\n",
"type": "text"
},
"role": "user"
}
]
},
"id": 444
}

the text of the prompt is escaped to fit inside a string JSON property.

In the Claude interface, the result of the submission is the text of the prompt as an attachment to your chat:

and if you click on the attachment, you can see the text of the prompt:

When you submit your chat in Claude, the magic happens:

Because of the instruction at line 2. , the LLM knows how to retrieve that Notion page by calling your tool and it asks permission first:

Here again if shows you what Claude is doing with regards to the calls to your MCP server:

In this example, the Notion page is … the page that you are reading here.

This is the summary provided by Claude:

The document discusses the Model Context Protocol (MCP) and its capabilities, specifically focusing on a Golang SDK release (v0.3.0) that introduces new server capabilities for prompts. The key innovation is the ability to create tools that can interact with various services, such as retrieving Notion pages, and integrating them into workflow templates.

The text explains how users can leverage these capabilities within the Claude interface by accessing MCP server integrations. It demonstrates a specific use case where a tool can retrieve a Notion page by its ID, showcasing the potential for creating flexible and reusable workflows. The protocol allows for dynamic interaction between language models, tools, and external data sources, enabling more sophisticated and context-aware interactions.

The document provides a technical overview of how these integrations work, including the process of making RPC calls, substituting parameters, and handling tool interactions within the Claude interface. It highlights the potential for creating more powerful and adaptable AI-driven workflows by combining language models with specialized tools.

Not too bad right?