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

Function runLogic

src/test-utils/test-helpers.ts:106–133  ·  view source on GitHub ↗
(logic: () => Promise<unknown>)

Source from the content-addressed store, hash-verified

104 * ToolResponse-shaped result for backward-compatible test assertions.
105 */
106export async function runLogic(logic: () => Promise<unknown>): Promise<RunLogicResult> {
107 const { result, run } = createMockToolHandlerContext();
108 const response = await run(logic);
109
110 if (
111 response &&
112 typeof response === 'object' &&
113 'content' in (response as Record<string, unknown>)
114 ) {
115 return response as RunLogicResult;
116 }
117
118 const text = result.text();
119 const textContent = text.length > 0 ? [{ type: 'text' as const, text }] : [];
120 const imageContent = result.attachments.map((attachment) => ({
121 type: 'image' as const,
122 data: attachment.data,
123 mimeType: attachment.mimeType,
124 }));
125
126 return {
127 content: [...textContent, ...imageContent],
128 isError: result.isError() ? true : undefined,
129 nextStepParams: result.nextStepParams,
130 attachments: result.attachments,
131 text,
132 };
133}
134
135export interface CallHandlerResult {
136 content: Array<{ type: 'text'; text: string }>;

Callers 1

Calls 4

runFunction · 0.85
textMethod · 0.80
isErrorMethod · 0.65

Tested by

no test coverage detected