UNPKG

@tanstack/ai-mcp

Version:

Host-side Model Context Protocol client for TanStack AI: discover and run MCP server tools, resources, and prompts in any adapter's chat() loop, with generated end-to-end types.

26 lines (25 loc) 751 B
//#region src/resources.ts /** * Converts a single MCP resource content block to a TanStack `ContentPart`. * * - `text` field present → `{ type: 'text', content: text }` * - `blob` field present → `{ type: 'text', content: '[binary resource <uri>]' }` * - otherwise → `{ type: 'text', content: JSON.stringify(content) }` */ function mcpResourceToContentPart(content) { if (typeof content.text === "string") return { type: "text", content: content.text }; if (typeof content.blob === "string") return { type: "text", content: `[binary resource ${content.uri ?? ""}]` }; return { type: "text", content: JSON.stringify(content) }; } //#endregion export { mcpResourceToContentPart }; //# sourceMappingURL=resources.js.map