pi-mcp-extension 1.5.3 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-mcp-extension",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "MCP (Model Context Protocol) client extension for the Pi coding agent — connect Pi to any MCP server",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -226,7 +226,7 @@ export function buildToolName(prefix: string, serverName: string, toolName: stri
226
226
  type PiTextContent = { type: "text"; text: string };
227
227
  type PiImageContent = { type: "image"; data: string; mimeType: string };
228
228
 
229
- function convertMcpContent(items: unknown[]): (PiTextContent | PiImageContent)[] {
229
+ export function convertMcpContent(items: unknown[]): (PiTextContent | PiImageContent)[] {
230
230
  return items.map((item: any) => {
231
231
  if (!item || typeof item !== "object") {
232
232
  return { type: "text", text: String(item) };
@@ -448,7 +448,8 @@ export class ToolBridge {
448
448
  // Tool execution errors (isError: true) — distinct from protocol errors
449
449
  if (result.isError) {
450
450
  const errorText = content
451
- .map((c) => (c.type === "text" ? c.text : ""))
451
+ .filter((c): c is PiTextContent => c.type === "text")
452
+ .map((c) => c.text)
452
453
  .join("\n");
453
454
  throw new McpError(
454
455
  errorText || "Tool reported an error",