MCPcopy Create free account
hub / github.com/bytebase/dbhub / formatPromptErrorResponse

Function formatPromptErrorResponse

src/utils/response-formatter.ts:168–197  ·  view source on GitHub ↗
(
  error: string,
  code: string = "ERROR"
)

Source from the content-addressed store, hash-verified

166 * Format an error prompt response in the MCP format
167 */
168export function formatPromptErrorResponse(
169 error: string,
170 code: string = "ERROR"
171): {
172 messages: Array<{
173 role: "assistant";
174 content: {
175 type: "text";
176 text: string;
177 };
178 }>;
179 error: string;
180 code: string;
181 _meta?: Record<string, unknown>;
182 [key: string]: unknown;
183} {
184 return {
185 messages: [
186 {
187 role: "assistant",
188 content: {
189 type: "text",
190 text: `Error: ${error}`,
191 },
192 },
193 ],
194 error,
195 code,
196 };
197}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected