mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 05:24:18 +02:00
Update title precedence
This commit is contained in:
parent
7d3dcdca03
commit
e0b6c321d2
4 changed files with 11 additions and 12 deletions
|
|
@ -99,10 +99,8 @@ class Prompt(FastMCPComponent, ABC):
|
|||
"name": self.name,
|
||||
"description": self.description,
|
||||
"arguments": arguments,
|
||||
"title": self.title,
|
||||
}
|
||||
# Add title field if provided
|
||||
if self.title is not None:
|
||||
kwargs["title"] = self.title
|
||||
return MCPPrompt(**kwargs | overrides)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -113,10 +113,8 @@ class Resource(FastMCPComponent, abc.ABC):
|
|||
"name": self.name,
|
||||
"description": self.description,
|
||||
"mimeType": self.mime_type,
|
||||
"title": self.title,
|
||||
}
|
||||
# Add title field if provided
|
||||
if self.title is not None:
|
||||
kwargs["title"] = self.title
|
||||
return MCPResource(**kwargs | overrides)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
|
|
|
|||
|
|
@ -146,10 +146,8 @@ class ResourceTemplate(FastMCPComponent):
|
|||
"name": self.name,
|
||||
"description": self.description,
|
||||
"mimeType": self.mime_type,
|
||||
"title": self.title,
|
||||
}
|
||||
# Add title field if provided
|
||||
if self.title is not None:
|
||||
kwargs["title"] = self.title
|
||||
return MCPResourceTemplate(**kwargs | overrides)
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -135,16 +135,21 @@ class Tool(FastMCPComponent):
|
|||
pass # No context available
|
||||
|
||||
def to_mcp_tool(self, **overrides: Any) -> MCPTool:
|
||||
if self.title:
|
||||
title = self.title
|
||||
elif self.annotations and self.annotations.title:
|
||||
title = self.annotations.title
|
||||
else:
|
||||
title = None
|
||||
|
||||
kwargs = {
|
||||
"name": self.name,
|
||||
"description": self.description,
|
||||
"inputSchema": self.parameters,
|
||||
"outputSchema": self.output_schema,
|
||||
"annotations": self.annotations,
|
||||
"title": title,
|
||||
}
|
||||
# Add title field if provided
|
||||
if self.title is not None:
|
||||
kwargs["title"] = self.title
|
||||
return MCPTool(**kwargs | overrides)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue