MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / assertValidMcpBlock

Function assertValidMcpBlock

packages/agent-core/test/mcp/output.test.ts:22–28  ·  view source on GitHub ↗

* Assert a test fixture matches the MCP SDK's ContentBlock schema. This * guards against fixtures that drift from the real protocol shape — exactly * the failure mode that previously hid the EmbeddedResource bug.

(block: T)

Source from the content-addressed store, hash-verified

20 * the failure mode that previously hid the EmbeddedResource bug.
21 */
22function assertValidMcpBlock<T extends MCPContentBlock>(block: T): T {
23 const parsed = ContentBlockSchema.safeParse(block);
24 if (!parsed.success) {
25 throw new Error(`fixture is not a valid MCP ContentBlock: ${parsed.error.message}`);
26 }
27 return block;
28}
29
30describe('convertMCPContentBlock', () => {
31 test('converts text block to TextPart', () => {

Callers 1

output.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected