Hello,
I’m currently implementing an MCP which exposes two endpoints. The implementation works good so far but for one thing. Below is the definition of one of the method
@mcp.tool(description=“A tool to search for french laws”)
async def search_law(
query: Annotated[
str | None,
‘Text search within article content. Pass empty string “” when filtering only by metadata (e.g., when searching by article_id). Use text keywords when searching content.’,
],
filter: LawFilterInput,
) → dict[str, Any] | None:
The issue I’m encountering is that ChatGPT is not able to understand the type of the parameter filter by default it assumes that the filter parameter is of type Any which is incorrect. The LawFilterInput
parameter is a Pydantic class which you can found part of the definition below:
class LawFilterInput(BaseModel):
status: str | None = Field(None, description=“The status of the law e.g: ‘vigueur’”)
law_title: str | None = Field(None, description=“The title of the law e.g: ‘Code général des impôts’”
)
What I’ve found interesting is that Claude is able to understand the underlying type of the filter parameter.
By allowing ChatGPT to understand the typing of the filter parameter. This would allow ChatGPT to better use my exposed MCP method rather than seeing ChatGPT trying some creative but wrong way of communicating with my MCP (especially for filtering).
Does anyone have any idea why ChatGPT isn’t able to found the underlying type of the filter parameter ? (The query parameter is interpreted correctly by ChatGPT)