MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / writeJson

Function writeJson

packages/plugins/mcp/src/testing/server.ts:38–49  ·  view source on GitHub ↗
(
  response: http.ServerResponse,
  status: number,
  body: Readonly<Record<string, unknown>>,
  headers: Readonly<Record<string, string>> = {},
)

Source from the content-addressed store, hash-verified

36}> {}
37
38const writeJson = (
39 response: http.ServerResponse,
40 status: number,
41 body: Readonly<Record<string, unknown>>,
42 headers: Readonly<Record<string, string>> = {},
43) => {
44 response.writeHead(status, {
45 "content-type": "application/json",
46 ...headers,
47 });
48 response.end(JSON.stringify(body));
49};
50
51const writeText = (response: http.ServerResponse, status: number, body: string) => {
52 response.writeHead(status, { "content-type": "text/plain; charset=utf-8" });

Callers 1

handleMcpRequestFunction · 0.85

Calls 1

endMethod · 0.80

Tested by

no test coverage detected