Skip to content

Commit 40fe1ec

Browse files
committed
fix bug
1 parent 93ee363 commit 40fe1ec

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

app/course/[slug]/page.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ export async function generateStaticParams() {
1212
}))
1313
}
1414

15-
export function generateMetadata({ params }: { params: { slug: string } }) {
16-
const courseModule = getCourseModules().find((module) => module.slug === params.slug)
15+
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }) {
16+
const { slug } = await params
17+
const courseModule = getCourseModules().find((module) => module.slug === slug)
1718
if (!courseModule) {
1819
return
1920
}
@@ -52,8 +53,9 @@ export function generateMetadata({ params }: { params: { slug: string } }) {
5253
}
5354
}
5455

55-
export default async function CourseModule({ params }: { params: { slug: string } }) {
56-
const courseModule = getCourseModules().find((module) => module.slug === params.slug)
56+
export default async function CourseModule({ params }: { params: Promise<{ slug: string }> }) {
57+
const { slug } = await params
58+
const courseModule = getCourseModules().find((module) => module.slug === slug)
5759

5860
if (!courseModule) {
5961
notFound()

app/course/modules/module4.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def add(a: int, b: int) -> int:
4141
return a + b
4242

4343
# Define a resource for personalized greetings
44-
@mcp.resource("greeting://{name}")
44+
@mcp.resource("greeting://user")
4545
def get_greeting(name: str) -> str:
4646
"""Get a personalized greeting."""
4747
return f"Hello, {name}!"
@@ -53,7 +53,7 @@ def get_greeting(name: str) -> str:
5353
Decorators are like labels that tell FastMCP how to use your functions. Here’s what they do:
5454

5555
- `@mcp.tool():` Makes a function a tool for actions like calculations, using docstrings and type hints to define it.
56-
- `@mcp.resource():` Sets up a data source, like a message, accessible via a URI (e.g., greeting://{name}).
56+
- `@mcp.resource():` Sets up a data source, like a message, accessible via a URI (e.g., greeting://user).
5757
- `@mcp.prompt():` Creates a template to guide AI responses, such as for questions or summaries.
5858

5959
**Why Different?**

0 commit comments

Comments
 (0)