Differentiate the primitives

This commit is contained in:
Justin Spahr-Summers 2024-11-21 15:35:18 +00:00
commit 75b32848a2
No known key found for this signature in database
3 changed files with 23 additions and 9 deletions

View file

@ -5,6 +5,10 @@ description: "Create resuable prompt templates and workflows"
Prompts enable servers to define reusable prompt templates and workflows that clients can easily surface to users and LLMs. They provide a powerful way to standardize and share common LLM interactions.
<Note>
Prompts are designed to be **user-controlled**, meaning they are exposed from servers to clients with the intention of the user being able to explicitly select them for use.
</Note>
## Overview
Prompts in MCP are predefined templates that can:

View file

@ -5,6 +5,12 @@ description: "Expose data and content from your servers to LLMs"
Resources are a core primitive in the Model Context Protocol (MCP) that allow servers to expose data and content that can be read by clients and used as context for LLM interactions.
<Note>
Resources are designed to be **application-controlled**, meaning that the client application can decide how and when they should be used.
For example, one application may require users to explicitly select resources, while another could automatically select them based on heuristics or even at the discretion of the AI model itself.
</Note>
## Overview
Resources represent any kind of data that an MCP server wants to make available to clients. This can include:

View file

@ -5,6 +5,10 @@ description: "Enable LLMs to perform actions through your server"
Tools are a powerful primitive in the Model Context Protocol (MCP) that enable servers to expose executable functionality to clients. Through tools, LLMs can interact with external systems, perform computations, and take actions in the real world.
<Note>
Tools are designed to be **model-controlled**, meaning that tools are exposed from servers to clients with the intention of the AI model being able to automatically invoke them (with a human in the loop to grant approval).
</Note>
## How tools work
Tools in MCP follow a request-response pattern where:
@ -79,10 +83,10 @@ For long-running operations, tools can report progress using the progress notifi
server.setRequestHandler(CallToolRequestSchema, async (request) => {
if (request.params.name === "long_process") {
const progressToken = request.params._meta?.progressToken;
for (let i = 0; i < total; i++) {
await doWork();
// Send progress update
await server.notification({
method: "notifications/progress",
@ -93,7 +97,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
}
});
}
return { toolResult: "Complete" };
}
});
@ -121,7 +125,7 @@ Tools that interact with the local system:
}
```
### API integrations
### API integrations
Tools that wrap external APIs:
@ -152,10 +156,10 @@ Tools that transform or analyze data:
type: "object",
properties: {
filepath: { type: "string" },
operations: {
type: "array",
items: {
enum: ["sum", "average", "count"]
operations: {
type: "array",
items: {
enum: ["sum", "average", "count"]
}
}
}
@ -276,4 +280,4 @@ Consider these testing approaches:
7. Test rate limiting
8. Check resource cleanup
9. Test timeout handling
10. Verify security constraints
10. Verify security constraints