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

Function writeJson

packages/plugins/mcp/src/testing/server.ts:42–53  ·  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

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

Callers 1

handleMcpRequestFunction · 0.70

Calls 1

endMethod · 0.80

Tested by

no test coverage detected