-
Notifications
You must be signed in to change notification settings - Fork 132
fix: wrap more tool responses in untrusted-user-data tags #465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import { z } from "zod"; | |
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; | ||
import { AtlasToolBase } from "../atlasTool.js"; | ||
import type { ToolArgs, OperationType } from "../../tool.js"; | ||
import { formatUntrustedData } from "../../tool.js"; | ||
|
||
export class InspectAccessListTool extends AtlasToolBase { | ||
public name = "atlas-inspect-access-list"; | ||
|
@@ -20,23 +21,25 @@ export class InspectAccessListTool extends AtlasToolBase { | |
}, | ||
}); | ||
|
||
if (!accessList?.results?.length) { | ||
throw new Error("No access list entries found."); | ||
const results = accessList.results ?? []; | ||
|
||
if (!results.length) { | ||
return { | ||
content: [{ type: "text", text: "No access list entries found." }], | ||
}; | ||
Comment on lines
+27
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this still be marked with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The question applies to multiple other tools where these changes were made. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think these should have been errors - not having access list entries is not an erroneous condition in and of itself. cc @blva to confirm. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, as a parallel the API itself returns 200. Everything was done correctly. Marking as error could lead customers/LLMs to think that the gathering information has failed |
||
} | ||
|
||
return { | ||
content: [ | ||
{ | ||
type: "text", | ||
text: `IP ADDRESS | CIDR | COMMENT | ||
content: formatUntrustedData( | ||
`Found ${results.length} access list entries`, | ||
`IP ADDRESS | CIDR | COMMENT | ||
------|------|------ | ||
${(accessList.results || []) | ||
${results | ||
.map((entry) => { | ||
return `${entry.ipAddress} | ${entry.cidrBlock} | ${entry.comment}`; | ||
}) | ||
.join("\n")}`, | ||
}, | ||
], | ||
.join("\n")}` | ||
), | ||
}; | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.