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)
|
const exit = yield* mcp.readResource(clientName, uri).pipe(Effect.exit)
|
||||||
if (Exit.isSuccess(exit)) {
|
if (Exit.isSuccess(exit)) {
|
||||||
const content = exit.value
|
const content = exit.value
|
||||||
if (!content) {
|
if (!content) throw new Error(`Failed to read MCP resource: ${clientName}/${uri}`)
|
||||||
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
|
|
||||||
}
|
|
||||||
const items = Array.isArray(content.contents) ? content.contents : [content.contents]
|
const items = Array.isArray(content.contents) ? content.contents : [content.contents]
|
||||||
for (const c of items) {
|
for (const c of items) {
|
||||||
if ("text" in c && c.text) {
|
if ("text" in c && c.text) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue