mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
mcp: propagate errors in tool schema parsing
This commit is contained in:
@@ -14,7 +14,7 @@ pub fn handleList(server: *Server, arena: std.mem.Allocator, req: protocol.Reque
|
|||||||
.{
|
.{
|
||||||
.name = "goto",
|
.name = "goto",
|
||||||
.description = "Navigate to a specified URL and load the page in memory so it can be reused later for info extraction.",
|
.description = "Navigate to a specified URL and load the page in memory so it can be reused later for info extraction.",
|
||||||
.inputSchema = std.json.parseFromSliceLeaky(std.json.Value, arena,
|
.inputSchema = try std.json.parseFromSliceLeaky(std.json.Value, arena,
|
||||||
\\{
|
\\{
|
||||||
\\ "type": "object",
|
\\ "type": "object",
|
||||||
\\ "properties": {
|
\\ "properties": {
|
||||||
@@ -22,12 +22,12 @@ pub fn handleList(server: *Server, arena: std.mem.Allocator, req: protocol.Reque
|
|||||||
\\ },
|
\\ },
|
||||||
\\ "required": ["url"]
|
\\ "required": ["url"]
|
||||||
\\}
|
\\}
|
||||||
, .{}) catch unreachable,
|
, .{}),
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
.name = "search",
|
.name = "search",
|
||||||
.description = "Use a search engine to look for specific words, terms, sentences. The search page will then be loaded in memory.",
|
.description = "Use a search engine to look for specific words, terms, sentences. The search page will then be loaded in memory.",
|
||||||
.inputSchema = std.json.parseFromSliceLeaky(std.json.Value, arena,
|
.inputSchema = try std.json.parseFromSliceLeaky(std.json.Value, arena,
|
||||||
\\{
|
\\{
|
||||||
\\ "type": "object",
|
\\ "type": "object",
|
||||||
\\ "properties": {
|
\\ "properties": {
|
||||||
@@ -35,36 +35,36 @@ pub fn handleList(server: *Server, arena: std.mem.Allocator, req: protocol.Reque
|
|||||||
\\ },
|
\\ },
|
||||||
\\ "required": ["text"]
|
\\ "required": ["text"]
|
||||||
\\}
|
\\}
|
||||||
, .{}) catch unreachable,
|
, .{}),
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
.name = "markdown",
|
.name = "markdown",
|
||||||
.description = "Get the page content in markdown format. If a url is provided, it navigates to that url first.",
|
.description = "Get the page content in markdown format. If a url is provided, it navigates to that url first.",
|
||||||
.inputSchema = std.json.parseFromSliceLeaky(std.json.Value, arena,
|
.inputSchema = try std.json.parseFromSliceLeaky(std.json.Value, arena,
|
||||||
\\{
|
\\{
|
||||||
\\ "type": "object",
|
\\ "type": "object",
|
||||||
\\ "properties": {
|
\\ "properties": {
|
||||||
\\ "url": { "type": "string", "description": "Optional URL to navigate to before fetching markdown." }
|
\\ "url": { "type": "string", "description": "Optional URL to navigate to before fetching markdown." }
|
||||||
\\ }
|
\\ }
|
||||||
\\}
|
\\}
|
||||||
, .{}) catch unreachable,
|
, .{}),
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
.name = "links",
|
.name = "links",
|
||||||
.description = "Extract all links in the opened page. If a url is provided, it navigates to that url first.",
|
.description = "Extract all links in the opened page. If a url is provided, it navigates to that url first.",
|
||||||
.inputSchema = std.json.parseFromSliceLeaky(std.json.Value, arena,
|
.inputSchema = try std.json.parseFromSliceLeaky(std.json.Value, arena,
|
||||||
\\{
|
\\{
|
||||||
\\ "type": "object",
|
\\ "type": "object",
|
||||||
\\ "properties": {
|
\\ "properties": {
|
||||||
\\ "url": { "type": "string", "description": "Optional URL to navigate to before extracting links." }
|
\\ "url": { "type": "string", "description": "Optional URL to navigate to before extracting links." }
|
||||||
\\ }
|
\\ }
|
||||||
\\}
|
\\}
|
||||||
, .{}) catch unreachable,
|
, .{}),
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
.name = "evaluate",
|
.name = "evaluate",
|
||||||
.description = "Evaluate JavaScript in the current page context. If a url is provided, it navigates to that url first.",
|
.description = "Evaluate JavaScript in the current page context. If a url is provided, it navigates to that url first.",
|
||||||
.inputSchema = std.json.parseFromSliceLeaky(std.json.Value, arena,
|
.inputSchema = try std.json.parseFromSliceLeaky(std.json.Value, arena,
|
||||||
\\{
|
\\{
|
||||||
\\ "type": "object",
|
\\ "type": "object",
|
||||||
\\ "properties": {
|
\\ "properties": {
|
||||||
@@ -73,12 +73,12 @@ pub fn handleList(server: *Server, arena: std.mem.Allocator, req: protocol.Reque
|
|||||||
\\ },
|
\\ },
|
||||||
\\ "required": ["script"]
|
\\ "required": ["script"]
|
||||||
\\}
|
\\}
|
||||||
, .{}) catch unreachable,
|
, .{}),
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
.name = "over",
|
.name = "over",
|
||||||
.description = "Used to indicate that the task is over and give the final answer if there is any. This is the last tool to be called in a task.",
|
.description = "Used to indicate that the task is over and give the final answer if there is any. This is the last tool to be called in a task.",
|
||||||
.inputSchema = std.json.parseFromSliceLeaky(std.json.Value, arena,
|
.inputSchema = try std.json.parseFromSliceLeaky(std.json.Value, arena,
|
||||||
\\{
|
\\{
|
||||||
\\ "type": "object",
|
\\ "type": "object",
|
||||||
\\ "properties": {
|
\\ "properties": {
|
||||||
@@ -86,7 +86,7 @@ pub fn handleList(server: *Server, arena: std.mem.Allocator, req: protocol.Reque
|
|||||||
\\ },
|
\\ },
|
||||||
\\ "required": ["result"]
|
\\ "required": ["result"]
|
||||||
\\}
|
\\}
|
||||||
, .{}) catch unreachable,
|
, .{}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user