Add title to tools, resources, prompts (#972)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
029f434109
commit
a2f8766a8a
3 changed files with 481 additions and 46 deletions
|
|
@ -53,6 +53,7 @@ def main(port: int, transport: str) -> int:
|
|||
return [
|
||||
types.Prompt(
|
||||
name="simple",
|
||||
title="Simple Assistant Prompt",
|
||||
description="A simple prompt that can take optional context and topic "
|
||||
"arguments",
|
||||
arguments=[
|
||||
|
|
|
|||
|
|
@ -5,9 +5,18 @@ from mcp.server.lowlevel import Server
|
|||
from pydantic import AnyUrl, FileUrl
|
||||
|
||||
SAMPLE_RESOURCES = {
|
||||
"greeting": "Hello! This is a sample text resource.",
|
||||
"help": "This server provides a few sample text resources for testing.",
|
||||
"about": "This is the simple-resource MCP server implementation.",
|
||||
"greeting": {
|
||||
"content": "Hello! This is a sample text resource.",
|
||||
"title": "Welcome Message",
|
||||
},
|
||||
"help": {
|
||||
"content": "This server provides a few sample text resources for testing.",
|
||||
"title": "Help Documentation",
|
||||
},
|
||||
"about": {
|
||||
"content": "This is the simple-resource MCP server implementation.",
|
||||
"title": "About This Server",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -28,6 +37,7 @@ def main(port: int, transport: str) -> int:
|
|||
types.Resource(
|
||||
uri=FileUrl(f"file:///{name}.txt"),
|
||||
name=name,
|
||||
title=SAMPLE_RESOURCES[name]["title"],
|
||||
description=f"A sample text resource named {name}",
|
||||
mimeType="text/plain",
|
||||
)
|
||||
|
|
@ -43,7 +53,7 @@ def main(port: int, transport: str) -> int:
|
|||
if name not in SAMPLE_RESOURCES:
|
||||
raise ValueError(f"Unknown resource: {uri}")
|
||||
|
||||
return SAMPLE_RESOURCES[name]
|
||||
return SAMPLE_RESOURCES[name]["content"]
|
||||
|
||||
if transport == "sse":
|
||||
from mcp.server.sse import SseServerTransport
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ def main(port: int, transport: str) -> int:
|
|||
return [
|
||||
types.Tool(
|
||||
name="fetch",
|
||||
title="Website Fetcher",
|
||||
description="Fetches a website and returns its content",
|
||||
inputSchema={
|
||||
"type": "object",
|
||||
|
|
|
|||
Loading…
Reference in a new issue