Ensure gRPC/RPC interfaces follow consistent patterns for return types, error handling, and method design. Avoid creating duplicate RPC methods when existing ones can be reused, use proper gRPC clients instead of direct imports, and maintain type safety with specific parameter types rather than generic objects.
Ensure gRPC/RPC interfaces follow consistent patterns for return types, error handling, and method design. Avoid creating duplicate RPC methods when existing ones can be reused, use proper gRPC clients instead of direct imports, and maintain type safety with specific parameter types rather than generic objects.
Key principles:
Promise<Empty>
not Promise<void>
) to ensure compatibility across different platformsvalues: Record<string, any>
objectsExample of proper gRPC handler:
// Good - proper return type and error handling
export async function addRemoteMcpServer(
controller: Controller,
request: AddRemoteMcpServerRequest
): Promise<McpServers> {
if (!request.serverName) {
throw new Error("Server name is required") // Native gRPC error
}
const servers = await controller.mcpHub?.addRemoteServer(request.serverName, request.serverUrl)
return { mcpServers: convertMcpServersToProtoMcpServers(servers) }
}
// Bad - generic response with custom error handling
interface CustomResponse {
success: boolean
error?: string
values?: Record<string, any>
}
This ensures API interfaces are predictable, type-safe, and work consistently across different client implementations.
Enter the URL of a public GitHub repository