Skip to content

Commit

Permalink
fix prompts section
Browse files Browse the repository at this point in the history
  • Loading branch information
ezynda3 committed Dec 11, 2024
1 parent 711de0c commit bfec18e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,12 @@ Prompts are reusable templates that help LLMs interact with your server effectiv

```go
// Simple greeting prompt
s.AddPrompt("greeting", func(args map[string]string) (*mcp.GetPromptResult, error) {
s.AddPrompt(mcp.NewPrompt("greeting",
mcp.WithPromptDescription("A friendly greeting prompt"),
mcp.WithArgument("name",
mcp.ArgumentDescription("Name of the person to greet"),
),
), func(args map[string]string) (*mcp.GetPromptResult, error) {
name := args["name"]
if name == "" {
name = "friend"
Expand Down Expand Up @@ -616,7 +621,13 @@ s.AddPrompt(mcp.NewPrompt("code_review",
})

// Database query builder prompt
s.AddPrompt("query_builder", func(args map[string]string) (*mcp.GetPromptResult, error) {
s.AddPrompt(mcp.NewPrompt("query_builder",
mcp.WithPromptDescription("SQL query builder assistance"),
mcp.WithArgument("table",
mcp.ArgumentDescription("Name of the table to query"),
mcp.RequiredArgument(),
),
), func(args map[string]string) (*mcp.GetPromptResult, error) {
tableName := args["table"]
if tableName == "" {
return nil, fmt.Errorf("table name is required")
Expand Down
7 changes: 3 additions & 4 deletions examples/server/everything/stdio/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ func NewMCPServer() *MCPServer {
"test://static/resource/{id}",
s.handleResourceTemplate,
)
s.server.AddPrompt(mcp.Prompt{
Name: string(SIMPLE),
Description: "A simple prompt",
}, s.handleSimplePrompt)
s.server.AddPrompt(mcp.NewPrompt(string(SIMPLE),

Check failure on line 55 in examples/server/everything/stdio/main.go

View workflow job for this annotation

GitHub Actions / test

undefined: mcp.NewPrompt
mcp.WithPromptDescription("A simple prompt"),

Check failure on line 56 in examples/server/everything/stdio/main.go

View workflow job for this annotation

GitHub Actions / test

undefined: mcp.WithPromptDescription
), s.handleSimplePrompt)
s.server.AddPrompt(mcp.NewPrompt(string(COMPLEX),

Check failure on line 58 in examples/server/everything/stdio/main.go

View workflow job for this annotation

GitHub Actions / test

undefined: mcp.NewPrompt
mcp.WithPromptDescription("A complex prompt"),

Check failure on line 59 in examples/server/everything/stdio/main.go

View workflow job for this annotation

GitHub Actions / test

undefined: mcp.WithPromptDescription
mcp.WithArgument("temperature",

Check failure on line 60 in examples/server/everything/stdio/main.go

View workflow job for this annotation

GitHub Actions / test

undefined: mcp.WithArgument
Expand Down

0 comments on commit bfec18e

Please sign in to comment.