MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / invokeResource

Function invokeResource

src/snapshot-tests/resource-harness.ts:74–104  ·  view source on GitHub ↗
(resourceId: string)

Source from the content-addressed store, hash-verified

72}
73
74export async function invokeResource(resourceId: string): Promise<ResourceSnapshotResult> {
75 const manifest = resolveResourceManifest(resourceId);
76 if (!manifest) {
77 throw new Error(`Resource '${resourceId}' not found in manifest`);
78 }
79
80 const transport = new StdioClientTransport({
81 command: 'node',
82 args: [CLI_PATH, 'mcp'],
83 env: createSnapshotHarnessEnv({
84 NODE_ENV: 'test',
85 XCODEBUILDMCP_ENABLED_WORKFLOWS: '',
86 }),
87 stderr: 'pipe',
88 });
89
90 const client = new Client({ name: 'resource-snapshot-client', version: '1.0.0' });
91 await client.connect(transport, { timeout: 30_000 });
92
93 try {
94 const result = await client.readResource({ uri: manifest.uri }, { timeout: 120_000 });
95 const rawText = extractResourceText(result);
96
97 return {
98 text: normalizeResourceOutput(rawText),
99 rawText,
100 };
101 } finally {
102 await client.close();
103 }
104}

Callers 1

Calls 5

resolveResourceManifestFunction · 0.85
extractResourceTextFunction · 0.85
normalizeResourceOutputFunction · 0.85
createSnapshotHarnessEnvFunction · 0.70
closeMethod · 0.65

Tested by

no test coverage detected