In the processor.py, the following code:
async def format_prompts(self, session):
"""Format the prompts for the MCP server"""
prompts = []
available_prompts = await session.list_prompts()
logger.debug(f"PromptProcessor.format_prompts: Available prompts: {available_prompts}")
for prompt in available_prompts.prompts:
prompt_result = await session.get_prompt(prompt.name, prompt.arguments if prompt.arguments else {})
formatted_prompt = {
"name": prompt.name,
"description": prompt_result.description,
"messages": [{
"role": msg.role,
"content": msg.content.text
} for msg in prompt_result.messages]
}
prompts.append(formatted_prompt)
return prompts
Here, type(prompt.arguments) is list, but the second parameter of session.get_prompt() requires a dict type. Therefore, if the arguments parameter in the return value corresponding to the @server.list_prompts() annotation in the mcp-server is not an empty list, an error will definitely occur here.
The reason for this error is that in the mcp-server we previously wrote, the @server.list_prompts() annotation was used to return system prompts, so the arguments parameter was always an empty list. However, currently in various open - source mcp-server implementations, this annotation is used to generate special prompts for users based on the prompt name and parameters.
Since we don't seem to have a scenario where we generate special prompts based on the prompt name and parameters, we might be able to use the @server.list_prompts() annotation in the mcp-server specifically to store system prompts for this mcp-server.
This issue currently does not affect the main logic, so it is only recorded for now and will be changed later.
In the processor.py, the following code:
Here, type(prompt.arguments) is list, but the second parameter of session.get_prompt() requires a dict type. Therefore, if the arguments parameter in the return value corresponding to the
@server.list_prompts()annotation in the mcp-server is not an empty list, an error will definitely occur here.The reason for this error is that in the mcp-server we previously wrote, the
@server.list_prompts()annotation was used to return system prompts, so the arguments parameter was always an empty list. However, currently in various open - source mcp-server implementations, this annotation is used to generate special prompts for users based on the prompt name and parameters.Since we don't seem to have a scenario where we generate special prompts based on the prompt name and parameters, we might be able to use the
@server.list_prompts()annotation in the mcp-server specifically to store system prompts for this mcp-server.This issue currently does not affect the main logic, so it is only recorded for now and will be changed later.