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

Function readJsonObject

src/core/structured-output-schema.ts:57–78  ·  view source on GitHub ↗
(filePath: string, label: string)

Source from the content-addressed store, hash-verified

55}
56
57function readJsonObject(filePath: string, label: string): JsonObject {
58 let raw: string;
59 try {
60 raw = fs.readFileSync(filePath, 'utf8');
61 } catch (error) {
62 const message = error instanceof Error ? error.message : String(error);
63 throw new Error(`Failed to read ${label} at ${filePath}: ${message}`);
64 }
65
66 let parsed: unknown;
67 try {
68 parsed = JSON.parse(raw) as unknown;
69 } catch (error) {
70 const message = error instanceof Error ? error.message : String(error);
71 throw new Error(`Failed to parse ${label} at ${filePath}: ${message}`);
72 }
73
74 if (!isRecord(parsed)) {
75 throw new Error(`${label} at ${filePath} must be a JSON object.`);
76 }
77 return parsed;
78}
79
80function schemaPathFor(ref: StructuredOutputSchemaRef): string {
81 const schemasDir = getStructuredOutputSchemasDir();

Callers 1

getMcpOutputSchemaFunction · 0.85

Calls 1

isRecordFunction · 0.70

Tested by

no test coverage detected