MCPcopy Index your code
hub / github.com/simstudioai/sim / buildMarkdownMultipartBody

Function buildMarkdownMultipartBody

apps/sim/tools/google_docs/create.ts:15–29  ·  view source on GitHub ↗

* Build a multipart/related body for Drive's files.create upload endpoint. * Used when converting Markdown to a Google Doc in a single round-trip. * See: https://developers.google.com/workspace/drive/api/guides/manage-uploads

(
  metadata: Record<string, unknown>,
  markdownContent: string,
  boundary: string
)

Source from the content-addressed store, hash-verified

13 * See: https://developers.google.com/workspace/drive/api/guides/manage-uploads
14 */
15function buildMarkdownMultipartBody(
16 metadata: Record<string, unknown>,
17 markdownContent: string,
18 boundary: string
19): string {
20 return (
21 `--${boundary}\r\n` +
22 `Content-Type: application/json; charset=UTF-8\r\n\r\n` +
23 `${JSON.stringify(metadata)}\r\n` +
24 `--${boundary}\r\n` +
25 `Content-Type: text/markdown\r\n\r\n` +
26 `${markdownContent}\r\n` +
27 `--${boundary}--`
28 )
29}
30
31function shouldUseMarkdownUpload(params: GoogleDocsToolParams): boolean {
32 return Boolean(params.markdown && params.content)

Callers 1

create.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected