You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This does not work and will throw an error on startup:
AttributeError: 'Server' object has no attribute 'list_resource_templates'
To Reproduce
Add code to
@app.list_resource_templates()
async def list_resource_templates() -> list[ResourceTemplate]:
"""List available resources."""
retur [
ResourceTemplate(
uriTemplate="note://obsidian/{path}",
name="A obsidian note",
description="Obsidian note identified by a path relative to root vault",
mimeType="application/txt"
)
]
Start server either via uv run or via Claude UI
Expected behavior
Server should start and ResourceTemplates should be exposed to Client
Logs
Traceback (most recent call last):
File "/Users/markus/experiments/claude-mvp/mvp-knowledge-base/.venv/bin/mcp-knowledge-base", line 5, in <module>
from mcp_knowledge_base import main
File "/Users/markus/experiments/claude-mvp/mvp-knowledge-base/src/mcp_knowledge_base/__init__.py", line 1, in <module>
from . import server
File "/Users/markus/experiments/claude-mvp/mvp-knowledge-base/src/mcp_knowledge_base/server.py", line 72, in <module>
@app.list_resource_templates()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Server' object has no attribute 'list_resource_templates'
Additional context
The text was updated successfully, but these errors were encountered:
Describe the bug
The documentation states here: https://modelcontextprotocol.io/docs/first-server/python that one can expose ResourceTemplates with Python using the
@app.list_resource_templates()
decorator.This does not work and will throw an error on startup:
To Reproduce
Expected behavior
Server should start and ResourceTemplates should be exposed to Client
Logs
Additional context
The text was updated successfully, but these errors were encountered: