Skip to content

Conversation

megandsouza03
Copy link
Contributor

Issue: #602

The GetPromptResult class has the field description, however it is not getting returned when using the FastMCP server.

Example

INFO     Processing request of type GetPromptRequest                                                     server.py:534
meta=None description=None messages=[PromptMessage(role='user', content=TextContent(type='text', text='ABCABCABCB', annotations=None))]

Expected behavior

INFO     Processing request of type GetPromptRequest                                                     server.py:534
meta=None description="This prompt summarizes the brave search data" messages=[PromptMessage(role='user', content=TextContent(type='text', text='ABCABCABCB', annotations=None))]

Motivation and Context

Currently, retrieving both the description and messages for a prompt requires two separate calls: one to list_prompts to get the prompt names, and then individual get_prompt calls for each prompt to fetch the full details. This adds unnecessary complexity and overhead, as we then have to manually map the results together to create a complete prompt object with both description and messages.

Proposed Change

Update theget_prompt to return the prompt details (including description and messages) directly, reducing complexity.

How Has This Been Tested?

  • Tested locally
  • Added a new test test_get_prompt_with_description

Breaking Changes

No breaking changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

dsp-ant and others added 11 commits February 13, 2025 16:40
The character encoding of the stdin/stdout streams in Python is platform-
dependent. On Windows it will be something weird, like CP437 or CP1252,
depending on the locale. This change ensures that no matter the platform,
UTF-8 is used.
…col#218)

Adds sampling and list roots callbacks to the ClientSession, allowing the client to handle requests from the server.

Co-authored-by: TerminalMan <[email protected]>
Co-authored-by: David Soria Parra <[email protected]>
…/jerome/fix/request-context-typing

Updated typing on request context for the server to use server session
…ontextprotocol#222)

* feat: allow lowlevel servers to return a list of resources

The resource/read message in MCP allows of multiple resources
to be returned. However, in the SDK we do not allow this. This
change is such that we allow returning multiple resource in
the lowlevel API if needed. However in FastMCP we stick to
one, since a FastMCP resource defines the mime_type in the decorator
and hence a resource cannot dynamically return different mime_typed resources.
It also is just the better default to only return one resource.
However in the lowlevel API we will allow this.

Strictly speaking this is not a BC break since the new return value
is additive, but if people subclassed server, it will break them.

* feat: lower the type requriements for call_tool to Iterable
ihrpr
ihrpr previously requested changes May 23, 2025
Copy link
Contributor

@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!

Looks like there are some refactoring opportunities. Both get_prompt and render_prompt will look up the same prompt, which is inefficient.
The use of getattr(prompt, "description", None) suggests uncertainty about whether the prompt has a description attribute. It should always have one.

Please can you refactor and then we can merge.


return GetPromptResult(messages=pydantic_core.to_jsonable_python(messages))
return GetPromptResult(
description=getattr(prompt, "description", None),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description=getattr(prompt, "description", None),
description=prompt.description if prompt else None,

@ihrpr ihrpr changed the base branch from v1.3.x to main July 9, 2025 19:05
felixweinberger
felixweinberger previously approved these changes Jul 9, 2025
Copy link
Contributor

@felixweinberger felixweinberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable

@ihrpr ihrpr dismissed their stale review July 9, 2025 19:37

added changes, Felix reviewed

@ihrpr ihrpr merged commit f55831e into modelcontextprotocol:main Jul 9, 2025
10 checks passed
saqadri pushed a commit to saqadri/stdio-fixes that referenced this pull request Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants