MCPcopy Create free account
hub / github.com/TanStack/ai / inlineBody

Function inlineBody

packages/ai-mcp/src/cli/emit.ts:115–120  ·  view source on GitHub ↗

* Extract the `{ ... }` body from a compiled `export interface X { ... }` * declaration so it can be inlined as an anonymous object type. Collapses * newlines onto a single line. Falls back to `unknown` when no brace is found * (e.g. the compiled type is itself `unknown`).

(compiled: string)

Source from the content-addressed store, hash-verified

113 * (e.g. the compiled type is itself `unknown`).
114 */
115function inlineBody(compiled: string): string {
116 const brace = compiled.indexOf('{')
117 return brace >= 0
118 ? compiled.slice(brace).replace(/\n/g, ' ').trim()
119 : 'unknown'
120}
121
122function emitResources(s: ServerSurface): string {
123 if (!s.resources.length) return '{}'

Callers 1

emitDescriptorsFunction · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected