Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

1.1 KB
Raw Blame
import * as fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';
import { decodeStructuredSchemaJson } from 'src/services/run-subagent-shared';

describe('run-subagent-output-mcp source', () => {
  it('[Given] a non-object schema file [Then] it rejects the malformed boundary payload', () => {
    expect(() => decodeStructuredSchemaJson('[]')).toThrow();
  });

  it('[Given] the structured output helper source [Then] it statically imports the MCP SDK', () => {
    const sourcePath = fileURLToPath(
      new URL('../../../src/services/run-subagent-output-mcp.ts', import.meta.url)
    );
    const source = fs.readFileSync(sourcePath, 'utf8');

    expect(source).toContain("from '@modelcontextprotocol/sdk/server/mcp.js'");
    expect(source).toContain("from '@modelcontextprotocol/sdk/server/stdio.js'");
    expect(source).toContain("from '@composio/json-schema-to-zod'");
    expect(source).not.toContain("from '@composio/core'");
    expect(source).not.toContain('@modelcontextprotocol/sdk/package.json');
    expect(source).not.toContain('createRequire(import.meta.url)');
  });
});