fix(opencode): fail unreadable MCP resources
This commit is contained in:
parent
325f105009
commit
0ecc41c83c
1 changed files with 1 additions and 10 deletions
|
|
@ -728,16 +728,7 @@ export const layer = Layer.effect(
|
|||
const exit = yield* mcp.readResource(clientName, uri).pipe(Effect.exit)
|
||||
if (Exit.isSuccess(exit)) {
|
||||
const content = exit.value
|
||||
if (!content) {
|
||||
pieces.push({
|
||||
messageID: info.id,
|
||||
sessionID: input.sessionID,
|
||||
type: "text",
|
||||
synthetic: true,
|
||||
text: `Failed to read MCP resource ${part.filename}: resource not found or could not be read`,
|
||||
})
|
||||
return pieces
|
||||
}
|
||||
if (!content) throw new Error(`Failed to read MCP resource: ${clientName}/${uri}`)
|
||||
const items = Array.isArray(content.contents) ? content.contents : [content.contents]
|
||||
for (const c of items) {
|
||||
if ("text" in c && c.text) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue