Skip to content

[BUG] Prompt #135

Open
Open
@pierre-sigwalt

Description

@pierre-sigwalt

Describe the bug
I have followed the document for prompting and getting the error when trying to get the prompt using the mcp client (ALso using MCP Inspector)

To Reproduce

  • prompt.py:
from fastmcp import FastMCP

template_mcp = FastMCP(name="Template")

@template_mcp.prompt()
def generate_content_request() -> str:
    """Create a request for generating content in a specific format."""
    prompt = f"Please write a "
    return prompt
  • server.py
import os

from fastmcp import FastMCP

from templates import template_mcp

mcp = FastMCP("Lj Template MCP")
mcp.mount(
    prefix="template",
    server=template_mcp
)

http_app = mcp.http_app(
    transport="streamable-http"
)
  • client.py
from fastmcp import Client
from fastmcp.client.transports import SSETransport

sse_transport = SSETransport(url=sse_url)
# transport_explicit = StreamableHttpTransport(url=http_url)

mcp_client = Client(sse_transport)

system_prompts = await mcp_client.get_prompt("template_generate_content_request")

Am I missing something?

Thank you for the help!

Error:

cannot access local variable 'new_key' where it is not associated with a value

System Info
Please specify the relevant information of your work environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions