prompts and resources as tools

This commit is contained in:
John Lancaster
2026-08-30 11:42:26 -05:00
parent b2ac4102f7
commit bbaa84720c
4 changed files with 53 additions and 11 deletions
+9 -2
View File
@@ -1,6 +1,8 @@
from __future__ import annotations
from fastmcp import FastMCP
from fastmcp.server.transforms import PromptsAsTools
from fastmcp.server.transforms import ResourcesAsTools
from mcp_types import Icon
from .prompts.provider import prompt_lifespan
@@ -10,8 +12,9 @@ from .skills import skill_lifespan
_SERVER_INSTRUCTIONS = """Personal development guidance exposed as native MCP resources and prompts.
Use prompts for parameterized workflows. For task-specific guidance, browse native skill resources,
select one skill://<name>/SKILL.md resource, and read its manifest only when supporting detail is needed.
Use prompts for parameterized workflows; tool-only agents can discover and render them with
list_prompts and get_prompt. For task-specific guidance, browse native skill resources, select one
skill://<name>/SKILL.md resource, and read its manifest only when supporting detail is needed.
"""
_SERVER_ICON = Icon(
src=(
@@ -59,6 +62,10 @@ def create_mcp() -> FastMCP:
def docs_markdown(path: str) -> dict[str, str]:
return read_docs_markdown_path(registry, path)
# Bridges tool-only clients that cannot browse native resources or prompts directly.
mcp.add_transform(ResourcesAsTools(mcp))
mcp.add_transform(PromptsAsTools(mcp))
return mcp