Files
herolib/lib/ai/mcpcore/model_error.v
2025-10-12 12:30:19 +03:00

43 lines
1.1 KiB
V

module mcpcore
import incubaid.herolib.schemas.jsonrpc
// resource_not_found indicates that the requested resource doesn't exist.
// This error is returned when the resource specified in the request is not found.
// Error code: -32002
pub fn resource_not_found(uri string) jsonrpc.RPCError {
return jsonrpc.RPCError{
code: -32002
message: 'Resource not found'
data: 'The requested resource ${uri} was not found.'
}
}
fn prompt_not_found(name string) jsonrpc.RPCError {
return jsonrpc.RPCError{
code: -32602 // Invalid params
message: 'Prompt not found: ${name}'
}
}
fn missing_required_argument(arg_name string) jsonrpc.RPCError {
return jsonrpc.RPCError{
code: -32602 // Invalid params
message: 'Missing required argument: ${arg_name}'
}
}
fn tool_not_found(name string) jsonrpc.RPCError {
return jsonrpc.RPCError{
code: -32602 // Invalid params
message: 'Tool not found: ${name}'
}
}
fn sampling_error(message string) jsonrpc.RPCError {
return jsonrpc.RPCError{
code: -32603 // Internal error
message: 'Sampling error: ${message}'
}
}