-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
structuredContent
causes type error
To Reproduce
interface SomeType {
data: string;
}
const server = new McpServer({
name: "MCP",
version: "1.0.0",
});
server.registerTool(
"name",
{
outputSchema: {
data: z.string(),
},
},
async () => { // type error
return {} as {
content: [];
structuredContent: SomeType;
isError?: boolean;
};
}
);
If I inline the type of structuredContent
within the code, it will not report a type error.
const server = new McpServer({
name: "MCP Refine",
version: "1.0.0",
});
server.registerTool(
"name",
{
outputSchema: {
data: z.string(),
},
},
async () => {
return {} as {
content: [];
structuredContent: {
data: string;
};
isError?: boolean;
};
}
);
Expected behavior
Do not cause the type error
Logs
Additional context
"@modelcontextprotocol/sdk": "1.17.1",
"zod": "3.25.76"
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working